From 7204f8e4ba027c6d4d5fd0277b4bb2ab9e11e3d8 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 5 Dec 2022 23:01:02 +0000 Subject: [PATCH 1/2] docs: Fix formatting for subnetwork field pattern PiperOrigin-RevId: 493082091 Source-Link: https://github.com/googleapis/googleapis/commit/45694d2bad602c52170096072d325aa644d550e5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a4cbce4bd525b58ee2473ef432c7164391dd4400 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1ldGFzdG9yZS8uT3dsQm90LnlhbWwiLCJoIjoiYTRjYmNlNGJkNTI1YjU4ZWUyNDczZWY0MzJjNzE2NDM5MWRkNDQwMCJ9 --- .../google-cloud-metastore/v1/.eslintignore | 7 + .../google-cloud-metastore/v1/.eslintrc.json | 3 + .../google-cloud-metastore/v1/.gitignore | 14 + .../google-cloud-metastore/v1/.jsdoc.js | 55 + .../google-cloud-metastore/v1/.mocharc.js | 33 + .../google-cloud-metastore/v1/.prettierrc.js | 22 + .../google-cloud-metastore/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../google-cloud-metastore/v1/package.json | 65 + .../google/cloud/metastore/v1/metastore.proto | 1316 ++++++ .../metastore/v1/metastore_federation.proto | 361 ++ .../v1/dataproc_metastore.create_backup.js | 92 + ...taproc_metastore.create_metadata_import.js | 93 + .../v1/dataproc_metastore.create_service.js | 93 + .../v1/dataproc_metastore.delete_backup.js | 77 + .../v1/dataproc_metastore.delete_service.js | 77 + .../v1/dataproc_metastore.export_metadata.js | 87 + .../v1/dataproc_metastore.get_backup.js | 63 + .../dataproc_metastore.get_metadata_import.js | 63 + .../v1/dataproc_metastore.get_service.js | 63 + .../v1/dataproc_metastore.list_backups.js | 90 + ...ataproc_metastore.list_metadata_imports.js | 90 + .../v1/dataproc_metastore.list_services.js | 90 + .../v1/dataproc_metastore.restore_service.js | 88 + ...taproc_metastore.update_metadata_import.js | 86 + .../v1/dataproc_metastore.update_service.js | 86 + ..._metastore_federation.create_federation.js | 93 + ..._metastore_federation.delete_federation.js | 77 + ...roc_metastore_federation.get_federation.js | 63 + ...c_metastore_federation.list_federations.js | 90 + ..._metastore_federation.update_federation.js | 86 + ...et_metadata.google.cloud.metastore.v1.json | 987 +++++ .../google-cloud-metastore/v1/src/index.ts | 27 + .../v1/src/v1/dataproc_metastore_client.ts | 3108 ++++++++++++++ .../v1/dataproc_metastore_client_config.json | 113 + .../dataproc_metastore_federation_client.ts | 1725 ++++++++ ...oc_metastore_federation_client_config.json | 46 + ...aproc_metastore_federation_proto_list.json | 4 + .../src/v1/dataproc_metastore_proto_list.json | 4 + .../v1/src/v1/gapic_metadata.json | 253 ++ .../google-cloud-metastore/v1/src/v1/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1/system-test/install.ts | 49 + .../gapic_dataproc_metastore_federation_v1.ts | 2000 +++++++++ .../v1/test/gapic_dataproc_metastore_v1.ts | 3672 ++++++++++++++++ .../google-cloud-metastore/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1alpha/.eslintignore | 7 + .../v1alpha/.eslintrc.json | 3 + .../google-cloud-metastore/v1alpha/.gitignore | 14 + .../google-cloud-metastore/v1alpha/.jsdoc.js | 55 + .../v1alpha/.mocharc.js | 33 + .../v1alpha/.prettierrc.js | 22 + .../google-cloud-metastore/v1alpha/README.md | 1 + .../v1alpha/linkinator.config.json | 16 + .../v1alpha/package.json | 65 + .../cloud/metastore/v1alpha/metastore.proto | 1462 +++++++ .../v1alpha/metastore_federation.proto | 364 ++ .../dataproc_metastore.create_backup.js | 92 + ...taproc_metastore.create_metadata_import.js | 93 + .../dataproc_metastore.create_service.js | 93 + .../dataproc_metastore.delete_backup.js | 77 + .../dataproc_metastore.delete_service.js | 77 + .../dataproc_metastore.export_metadata.js | 88 + .../v1alpha/dataproc_metastore.get_backup.js | 63 + .../dataproc_metastore.get_metadata_import.js | 63 + .../v1alpha/dataproc_metastore.get_service.js | 63 + .../dataproc_metastore.list_backups.js | 91 + ...ataproc_metastore.list_metadata_imports.js | 91 + .../dataproc_metastore.list_services.js | 92 + .../dataproc_metastore.restore_service.js | 88 + ...taproc_metastore.update_metadata_import.js | 86 + .../dataproc_metastore.update_service.js | 86 + ..._metastore_federation.create_federation.js | 93 + ..._metastore_federation.delete_federation.js | 77 + ...roc_metastore_federation.get_federation.js | 63 + ...c_metastore_federation.list_federations.js | 90 + ..._metastore_federation.update_federation.js | 86 + ...tadata.google.cloud.metastore.v1alpha.json | 987 +++++ .../v1alpha/src/index.ts | 27 + .../src/v1alpha/dataproc_metastore_client.ts | 3173 ++++++++++++++ .../dataproc_metastore_client_config.json | 113 + .../dataproc_metastore_federation_client.ts | 1725 ++++++++ ...oc_metastore_federation_client_config.json | 46 + ...aproc_metastore_federation_proto_list.json | 4 + .../dataproc_metastore_proto_list.json | 4 + .../v1alpha/src/v1alpha/gapic_metadata.json | 253 ++ .../v1alpha/src/v1alpha/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1alpha/system-test/install.ts | 49 + ...c_dataproc_metastore_federation_v1alpha.ts | 2000 +++++++++ .../test/gapic_dataproc_metastore_v1alpha.ts | 3718 +++++++++++++++++ .../v1alpha/tsconfig.json | 19 + .../v1alpha/webpack.config.js | 64 + .../v1beta/.eslintignore | 7 + .../v1beta/.eslintrc.json | 3 + .../google-cloud-metastore/v1beta/.gitignore | 14 + .../google-cloud-metastore/v1beta/.jsdoc.js | 55 + .../google-cloud-metastore/v1beta/.mocharc.js | 33 + .../v1beta/.prettierrc.js | 22 + .../google-cloud-metastore/v1beta/README.md | 1 + .../v1beta/linkinator.config.json | 16 + .../v1beta/package.json | 65 + .../cloud/metastore/v1beta/metastore.proto | 1462 +++++++ .../v1beta/metastore_federation.proto | 364 ++ .../dataproc_metastore.create_backup.js | 92 + ...taproc_metastore.create_metadata_import.js | 93 + .../dataproc_metastore.create_service.js | 93 + .../dataproc_metastore.delete_backup.js | 77 + .../dataproc_metastore.delete_service.js | 77 + .../dataproc_metastore.export_metadata.js | 88 + .../v1beta/dataproc_metastore.get_backup.js | 63 + .../dataproc_metastore.get_metadata_import.js | 63 + .../v1beta/dataproc_metastore.get_service.js | 63 + .../v1beta/dataproc_metastore.list_backups.js | 91 + ...ataproc_metastore.list_metadata_imports.js | 91 + .../dataproc_metastore.list_services.js | 92 + .../dataproc_metastore.restore_service.js | 88 + ...taproc_metastore.update_metadata_import.js | 86 + .../dataproc_metastore.update_service.js | 86 + ..._metastore_federation.create_federation.js | 93 + ..._metastore_federation.delete_federation.js | 77 + ...roc_metastore_federation.get_federation.js | 63 + ...c_metastore_federation.list_federations.js | 90 + ..._metastore_federation.update_federation.js | 86 + ...etadata.google.cloud.metastore.v1beta.json | 987 +++++ .../v1beta/src/index.ts | 27 + .../src/v1beta/dataproc_metastore_client.ts | 3173 ++++++++++++++ .../dataproc_metastore_client_config.json | 113 + .../dataproc_metastore_federation_client.ts | 1725 ++++++++ ...oc_metastore_federation_client_config.json | 46 + ...aproc_metastore_federation_proto_list.json | 4 + .../v1beta/dataproc_metastore_proto_list.json | 4 + .../v1beta/src/v1beta/gapic_metadata.json | 253 ++ .../v1beta/src/v1beta/index.ts | 20 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + .../v1beta/system-test/install.ts | 49 + ...ic_dataproc_metastore_federation_v1beta.ts | 2000 +++++++++ .../test/gapic_dataproc_metastore_v1beta.ts | 3718 +++++++++++++++++ .../v1beta/tsconfig.json | 19 + .../v1beta/webpack.config.js | 64 + 144 files changed, 47621 insertions(+) create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/README.md create mode 100644 owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/package.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/README.md create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/package.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.gitignore create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/README.md create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/package.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js diff --git a/owl-bot-staging/google-cloud-metastore/v1/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/.gitignore b/owl-bot-staging/google-cloud-metastore/v1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js new file mode 100644 index 00000000000..bc8b6fc164f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dataproc-metastore', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/README.md b/owl-bot-staging/google-cloud-metastore/v1/README.md new file mode 100644 index 00000000000..24afb9017c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/README.md @@ -0,0 +1 @@ +Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json b/owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/package.json b/owl-bot-staging/google-cloud-metastore/v1/package.json new file mode 100644 index 00000000000..b3e0a6424ad --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/dataproc-metastore", + "version": "0.1.0", + "description": "Metastore client for Node.js", + "repository": "googleapis/nodejs-metastore", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google metastore", + "metastore", + "dataproc metastore", + "dataproc metastore federation" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto new file mode 100644 index 00000000000..01431d9c12f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto @@ -0,0 +1,1316 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.metastore.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/dayofweek.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1;metastore"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreProto"; +option java_package = "com.google.cloud.metastore.v1"; +option php_namespace = "Google\\Cloud\\Metastore\\V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Subnetwork" + pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" +}; + +// Configures and manages metastore services. +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management +// software. Each metastore service exposes a network endpoint through which +// metadata queries are served. Metadata queries can originate from a variety +// of sources, including Apache Hive, Apache Presto, and Apache Spark. +// +// The Dataproc Metastore API defines the following resource model: +// +// * The service works with a collection of Google Cloud projects, named: +// `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// (a location must refer to a Google Cloud `region`) +// * Each location has a collection of services, named: `/services/*` +// * Dataproc Metastore services are resources with names of the form: +// +// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. +service DataprocMetastore { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists services in a project and location. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore service in a project and location. + rpc CreateService(CreateServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Updates the parameters of a single service. + rpc UpdateService(UpdateServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{service.name=projects/*/locations/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Deletes a single service. + rpc DeleteService(DeleteServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Lists imports in a service. + rpc ListMetadataImports(ListMetadataImportsRequest) returns (ListMetadataImportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single import. + rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/services/*/metadataImports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new MetadataImport in a given project and location. + rpc CreateMetadataImport(CreateMetadataImportRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" + body: "metadata_import" + }; + option (google.api.method_signature) = "parent,metadata_import,metadata_import_id"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Updates a single import. + // Only the description field of MetadataImport is supported to be updated. + rpc UpdateMetadataImport(UpdateMetadataImportRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" + body: "metadata_import" + }; + option (google.api.method_signature) = "metadata_import,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Exports metadata from a service. + rpc ExportMetadata(ExportMetadataRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:exportMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MetadataExport" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Restores a service from a backup. + rpc RestoreService(RestoreServiceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{service=projects/*/locations/*/services/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "service,backup"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Lists backups in a service. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/services/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new backup in a given project and location. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/services/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Deletes a single backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } +} + +// A managed metastore service that serves metadata queries. +message Service { + option (google.api.resource) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + }; + + // The current state of the metastore service. + enum State { + // The state of the metastore service is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore service is in the process of being created. + CREATING = 1; + + // The metastore service is running and ready to serve queries. + ACTIVE = 2; + + // The metastore service is entering suspension. Its query-serving + // availability may cease unexpectedly. + SUSPENDING = 3; + + // The metastore service is suspended and unable to serve queries. + SUSPENDED = 4; + + // The metastore service is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 5; + + // The metastore service is undergoing deletion. It cannot be used. + DELETING = 6; + + // The metastore service has encountered an error and cannot be used. The + // metastore service should be deleted. + ERROR = 7; + } + + // Available service tiers. + enum Tier { + // The tier is not set. + TIER_UNSPECIFIED = 0; + + // The developer tier provides limited scalability and no fault tolerance. + // Good for low-cost proof-of-concept. + DEVELOPER = 1; + + // The enterprise tier provides multi-zone high availability, and sufficient + // scalability for enterprise-level Dataproc Metastore workloads. + ENTERPRISE = 3; + } + + // Release channels bundle features of varying levels of stability. Newer + // features may be introduced initially into less stable release channels and + // can be automatically promoted into more stable release channels. + enum ReleaseChannel { + // Release channel is not specified. + RELEASE_CHANNEL_UNSPECIFIED = 0; + + // The `CANARY` release channel contains the newest features, which may be + // unstable and subject to unresolved issues with no known workarounds. + // Services using the `CANARY` release channel are not subject to any SLAs. + CANARY = 1; + + // The `STABLE` release channel contains features that are considered stable + // and have been validated for production use. + STABLE = 2; + } + + // The backend database type for the metastore service. + enum DatabaseType { + // The DATABASE_TYPE is not set. + DATABASE_TYPE_UNSPECIFIED = 0; + + // MySQL is used to persist the metastore data. + MYSQL = 1; + + // Spanner is used to persist the metastore data. + SPANNER = 2; + } + + // Configuration properties specific to the underlying metastore service + // technology (the software that serves metastore queries). + oneof metastore_config { + // Configuration information specific to running Hive metastore + // software as the metastore service. + HiveMetastoreConfig hive_metastore_config = 5; + } + + // Immutable. The relative resource name of the metastore service, in the following + // format: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore service was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore service was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore service. + map labels = 4; + + // Immutable. The relative resource name of the VPC network on which the instance can be + // accessed. It is specified in the following form: + // + // `projects/{project_number}/global/networks/{network_id}`. + string network = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Network" + } + ]; + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The TCP port at which the metastore service is reached. Default: 9083. + int32 port = 9; + + // Output only. The current state of the metastore service. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the metastore service, if + // available. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A Cloud Storage URI (starting with `gs://`) that specifies where artifacts + // related to the metastore service are stored. + string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The tier of the service. + Tier tier = 13; + + // The one hour maintenance window of the metastore service. This specifies + // when the service can be restarted for maintenance purposes in UTC time. + // Maintenance window is not needed for services with the SPANNER + // database type. + MaintenanceWindow maintenance_window = 15; + + // Output only. The globally unique resource identifier of the metastore service. + string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The metadata management activities of the metastore service. + MetadataManagementActivity metadata_management_activity = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The release channel of the service. + // If unspecified, defaults to `STABLE`. + ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Information used to configure the Dataproc Metastore service to encrypt + // customer data at rest. Cannot be updated. + EncryptionConfig encryption_config = 20 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying the network settings for the + // Dataproc Metastore service. + NetworkConfig network_config = 21; + + // Immutable. The database type that the Metastore service stores its data. + DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying telemetry settings for the Dataproc Metastore + // service. If unspecified defaults to `JSON`. + TelemetryConfig telemetry_config = 23; +} + +// Maintenance window. This specifies when Dataproc Metastore +// may perform system maintenance operation to the service. +message MaintenanceWindow { + // The hour of day (0-23) when the window starts. + google.protobuf.Int32Value hour_of_day = 1; + + // The day of week, when the window starts. + google.type.DayOfWeek day_of_week = 2; +} + +// Specifies configuration information specific to running Hive metastore +// software as the metastore service. +message HiveMetastoreConfig { + // Immutable. The Hive metastore schema version. + string version = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // Hive metastore (configured in `hive-site.xml`). The mappings + // override system defaults (some keys cannot be overridden). These + // overrides are also applied to auxiliary versions and can be further + // customized in the auxiliary version's `AuxiliaryVersionConfig`. + map config_overrides = 2; + + // Information used to configure the Hive metastore service as a service + // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + // method and specify this field's path + // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + // while omitting this field from the request's `service`. + KerberosConfig kerberos_config = 3; +} + +// Configuration information for a Kerberos principal. +message KerberosConfig { + // A Kerberos keytab file that can be used to authenticate a service principal + // with a Kerberos Key Distribution Center (KDC). + Secret keytab = 1; + + // A Kerberos principal that exists in the both the keytab the KDC + // to authenticate as. A typical principal is of the form + // `primary/instance@REALM`, but there is no exact format. + string principal = 2; + + // A Cloud Storage URI that specifies the path to a + // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + // although the file does not need to be named krb5.conf explicitly. + string krb5_config_gcs_uri = 3; +} + +// A securely stored value. +message Secret { + oneof value { + // The relative resource name of a Secret Manager secret version, in the + // following form: + // + // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + string cloud_secret = 2; + } +} + +// Encryption settings for the service. +message EncryptionConfig { + // The fully qualified customer provided Cloud KMS key name to use for + // customer data encryption, in the following form: + // + // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + string kms_key = 1; +} + +// Network configuration for the Dataproc Metastore service. +message NetworkConfig { + // Contains information of the customer's network configurations. + message Consumer { + oneof vpc_resource { + // Immutable. The subnetwork of the customer project from which an IP address is + // reserved and used as the Dataproc Metastore service's + // endpoint. It is accessible to hosts in the subnet and to all + // hosts in a subnet in the same region and same network. There must + // be at least one IP address available in the subnet's primary range. The + // subnet is specified in the following form: + // + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + string subnetwork = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Subnetwork" + } + ]; + } + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Immutable. The consumer-side network configuration for the Dataproc Metastore + // instance. + repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// Telemetry Configuration for the Dataproc Metastore service. +message TelemetryConfig { + enum LogFormat { + // The LOG_FORMAT is not set. + LOG_FORMAT_UNSPECIFIED = 0; + + // Logging output uses the legacy `textPayload` format. + LEGACY = 1; + + // Logging output uses the `jsonPayload` format. + JSON = 2; + } + + // The output format of the Dataproc Metastore service's logs. + LogFormat log_format = 1; +} + +// The metadata management activities of the metastore service. +message MetadataManagementActivity { + // Output only. The latest metadata exports of the metastore service. + repeated MetadataExport metadata_exports = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The latest restores of the metastore service. + repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A metastore resource that imports metadata. +message MetadataImport { + option (google.api.resource) = { + type: "metastore.googleapis.com/MetadataImport" + pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" + }; + + // A specification of the location of and metadata about a database dump from + // a relational database management system. + message DatabaseDump { + + // The type of the database. + enum DatabaseType { + // The type of the source database is unknown. + DATABASE_TYPE_UNSPECIFIED = 0; + + // The type of the source database is MySQL. + MYSQL = 1; + } + + // The type of the database. + DatabaseType database_type = 1 [deprecated = true]; + + // A Cloud Storage object or folder URI that specifies the source from which + // to import metadata. It must begin with `gs://`. + string gcs_uri = 2; + + // Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. + DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The current state of the metadata import. + enum State { + // The state of the metadata import is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata import is running. + RUNNING = 1; + + // The metadata import completed successfully. + SUCCEEDED = 2; + + // The metadata import is being updated. + UPDATING = 3; + + // The metadata import failed, and attempted metadata changes were rolled + // back. + FAILED = 4; + } + + // The metadata to be imported. + oneof metadata { + // Immutable. A database dump from a pre-existing metastore's database. + DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Immutable. The relative resource name of the metadata import, of the form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The description of the metadata import. + string description = 2; + + // Output only. The time when the metadata import was started. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import was last updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import finished. + google.protobuf.Timestamp end_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the metadata import. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata export operation. +message MetadataExport { + // The current state of the metadata export. + enum State { + // The state of the metadata export is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata export is running. + RUNNING = 1; + + // The metadata export completed successfully. + SUCCEEDED = 2; + + // The metadata export failed. + FAILED = 3; + + // The metadata export is cancelled. + CANCELLED = 4; + } + + oneof destination { + // Output only. A Cloud Storage URI of a folder that metadata are exported to, in the + // form of `gs:////`, where + // `` is automatically generated. + string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The time when the export started. + google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the export ended. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the export. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the database dump. + DatabaseDumpSpec.Type database_dump_type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a backup resource. +message Backup { + option (google.api.resource) = { + type: "metastore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" + }; + + // The current state of the backup. + enum State { + // The state of the backup is unknown. + STATE_UNSPECIFIED = 0; + + // The backup is being created. + CREATING = 1; + + // The backup is being deleted. + DELETING = 2; + + // The backup is active and ready to use. + ACTIVE = 3; + + // The backup failed. + FAILED = 4; + + // The backup is being restored. + RESTORING = 5; + } + + // Immutable. The relative resource name of the backup, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the backup was started. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup finished creating. + google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the service at the time of backup. + Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the backup. + string description = 6; + + // Output only. Services that are restoring from the backup. + repeated string restoring_services = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata restore operation. +message Restore { + // The current state of the restore. + enum State { + // The state of the metadata restore is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata restore is running. + RUNNING = 1; + + // The metadata restore completed successfully. + SUCCEEDED = 2; + + // The metadata restore failed. + FAILED = 3; + + // The metadata restore is cancelled. + CANCELLED = 4; + } + + // The type of restore. If unspecified, defaults to `METADATA_ONLY`. + enum RestoreType { + // The restore type is unknown. + RESTORE_TYPE_UNSPECIFIED = 0; + + // The service's metadata and configuration are restored. + FULL = 1; + + // Only the service's metadata is restored. + METADATA_ONLY = 2; + } + + // Output only. The time when the restore started. + google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the restore ended. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the restore. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the metastore service backup to restore + // from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Output only. The type of restore. + RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The restore details containing the revision of the service to be restored + // to, in format of JSON. + string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. +message ListServicesRequest { + // Required. The relative resource name of the location of metastore services to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of services to return. The response may contain less + // than the maximum number. If unspecified, no more than 500 services are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. +message ListServicesResponse { + // The services in the specified location. + repeated Service services = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for [DataprocMetastore.GetService][google.cloud.metastore.v1.DataprocMetastore.GetService]. +message GetServiceRequest { + // Required. The relative resource name of the metastore service to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Request message for [DataprocMetastore.CreateService][google.cloud.metastore.v1.DataprocMetastore.CreateService]. +message CreateServiceRequest { + // Required. The relative resource name of the location in which to create a metastore + // service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The ID of the metastore service, which is used as the final + // component of the metastore service's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore service to create. The `name` field is + // ignored. The ID of the created metastore service must be provided in + // the request's `service_id` field. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.UpdateService][google.cloud.metastore.v1.DataprocMetastore.UpdateService]. +message UpdateServiceRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore service resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore service to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore service's `name` field is used to identify the metastore + // service to be updated. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.DeleteService][google.cloud.metastore.v1.DataprocMetastore.DeleteService]. +message DeleteServiceRequest { + // Required. The relative resource name of the metastore service to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsRequest { + // Required. The relative resource name of the service whose metadata imports to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Optional. The maximum number of imports to return. The response may contain less + // than the maximum number. If unspecified, no more than 500 imports are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsResponse { + // The imports in the specified service. + repeated MetadataImport metadata_imports = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport]. +message GetMetadataImportRequest { + // Required. The relative resource name of the metadata import to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/MetadataImport" + } + ]; +} + +// Request message for [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport]. +message CreateMetadataImportRequest { + // Required. The relative resource name of the service in which to create a metastore + // import, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Required. The ID of the metadata import, which is used as the final component of the + // metadata import's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to create. The `name` field is ignored. The ID of the + // created metadata import must be provided in the request's + // `metadata_import_id` field. + MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport]. +message UpdateMetadataImportRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metadata import resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to update. The server only merges fields + // in the import if they are specified in `update_mask`. + // + // The metadata import's `name` field is used to identify the metastore + // import to be updated. + MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. +message ListBackupsRequest { + // Required. The relative resource name of the service whose backups to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The maximum number of backups to return. The response may contain less + // than the maximum number. If unspecified, no more than 500 backups are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. +message ListBackupsResponse { + // The backups of the specified service. + repeated Backup backups = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for [DataprocMetastore.GetBackup][google.cloud.metastore.v1.DataprocMetastore.GetBackup]. +message GetBackupRequest { + // Required. The relative resource name of the backup to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; +} + +// Request message for [DataprocMetastore.CreateBackup][google.cloud.metastore.v1.DataprocMetastore.CreateBackup]. +message CreateBackupRequest { + // Required. The relative resource name of the service in which to create a backup + // of the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Required. The ID of the backup, which is used as the final component of the + // backup's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. The `name` field is ignored. The ID of the created + // backup must be provided in the request's `backup_id` field. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. +message DeleteBackupRequest { + // Required. The relative resource name of the backup to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1.DataprocMetastore.ExportMetadata]. +message ExportMetadataRequest { + // Required. Destination that metadata is exported to. + oneof destination { + // A Cloud Storage URI of a folder, in the format + // `gs:///`. A sub-folder + // `` containing exported files will be created below it. + string destination_gcs_folder = 2; + } + + // Required. The relative resource name of the metastore service to run export, in the + // following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. + DatabaseDumpSpec.Type database_dump_type = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.Restore][]. +message RestoreServiceRequest { + // Required. The relative resource name of the metastore service to run restore, in the + // following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative resource name of the metastore service backup to restore + // from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the caller has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata about the service in a location. +message LocationMetadata { + // A specification of a supported version of the Hive Metastore software. + message HiveMetastoreVersion { + // The semantic version of the Hive Metastore software. + string version = 1; + + // Whether `version` will be chosen by the server if a metastore service is + // created with a `HiveMetastoreConfig` that omits the `version`. + bool is_default = 2; + } + + // The versions of Hive Metastore that can be used when creating a new + // metastore service in this location. The server guarantees that exactly one + // `HiveMetastoreVersion` in the list will set `is_default`. + repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; +} + +// The specification of database dump to import from or export to. +message DatabaseDumpSpec { + // The type of the database dump. + enum Type { + // The type of the database dump is unknown. + TYPE_UNSPECIFIED = 0; + + // Database dump is a MySQL dump file. + MYSQL = 1; + + // Database dump contains Avro files. + AVRO = 2; + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto new file mode 100644 index 00000000000..f3a95b1758d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto @@ -0,0 +1,361 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.metastore.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1;metastore"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreFederationProto"; +option java_package = "com.google.cloud.metastore.v1"; + +// Configures and manages metastore federation services. +// Dataproc Metastore Federation Service allows federating a collection of +// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc +// Metastores. The Federation Service exposes a gRPC URL through which metadata +// from the backend metastores are served at query time. +// +// The Dataproc Metastore Federation API defines the following resource model: +// * The service works with a collection of Google Cloud projects. +// * Each project has a collection of available locations. +// * Each location has a collection of federations. +// * Dataproc Metastore Federations are resources with names of the +// form: +// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. +service DataprocMetastoreFederation { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists federations in a project and location. + rpc ListFederations(ListFederationsRequest) returns (ListFederationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/federations" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single federation. + rpc GetFederation(GetFederationRequest) returns (Federation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore federation in a project and location. + rpc CreateFederation(CreateFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/federations" + body: "federation" + }; + option (google.api.method_signature) = "parent,federation,federation_id"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Updates the fields of a federation. + rpc UpdateFederation(UpdateFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{federation.name=projects/*/locations/*/federations/*}" + body: "federation" + }; + option (google.api.method_signature) = "federation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } + + // Deletes a single federation. + rpc DeleteFederation(DeleteFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1.OperationMetadata" + }; + } +} + +// Represents a federation of multiple backend metastores. +message Federation { + option (google.api.resource) = { + type: "metastore.googleapis.com/Federation" + pattern: "projects/{project}/locations/{location}/federations/{federation}" + }; + + // The current state of the federation. + enum State { + // The state of the metastore federation is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore federation is in the process of being created. + CREATING = 1; + + // The metastore federation is running and ready to serve queries. + ACTIVE = 2; + + // The metastore federation is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 3; + + // The metastore federation is undergoing deletion. It cannot be used. + DELETING = 4; + + // The metastore federation has encountered an error and cannot be used. The + // metastore federation should be deleted. + ERROR = 5; + } + + // Immutable. The relative resource name of the federation, of the + // form: + // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore federation was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore federation was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore federation. + map labels = 4; + + // Immutable. The Apache Hive metastore version of the federation. All backend metastore + // versions must be compatible with the federation version. + string version = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // A map from `BackendMetastore` rank to `BackendMetastore`s from which the + // federation service serves metadata at query time. The map key represents + // the order in which `BackendMetastore`s should be evaluated to resolve + // database names at query time and should be greater than or equal to zero. A + // `BackendMetastore` with a lower number will be evaluated before a + // `BackendMetastore` with a higher number. + map backend_metastores = 6; + + // Output only. The federation endpoint. + string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the federation. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the metastore federation, + // if available. + string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The globally unique resource identifier of the metastore federation. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a backend metastore for the federation. +message BackendMetastore { + // The type of the backend metastore. + enum MetastoreType { + // The metastore type is not set. + METASTORE_TYPE_UNSPECIFIED = 0; + + // The backend metastore is Dataproc Metastore. + DATAPROC_METASTORE = 3; + } + + // The relative resource name of the metastore that is being federated. + // The formats of the relative resource names for the currently supported + // metastores are listed below: + // + // * Dataplex + // * `projects/{project_id}/locations/{location}/lakes/{lake_id}` + // * BigQuery + // * `projects/{project_id}` + // * Dataproc Metastore + // * `projects/{project_id}/locations/{location}/services/{service_id}` + string name = 1; + + // The type of the backend metastore. + MetastoreType metastore_type = 2; +} + +// Request message for ListFederations. +message ListFederationsRequest { + // Required. The relative resource name of the location of metastore federations + // to list, in the following form: + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. The maximum number of federations to return. The response may contain less + // than the maximum number. If unspecified, no more than 500 services are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous ListFederationServices + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // ListFederationServices must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListFederations +message ListFederationsResponse { + // The services in the specified location. + repeated Federation federations = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetFederation. +message GetFederationRequest { + // Required. The relative resource name of the metastore federation to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; +} + +// Request message for CreateFederation. +message CreateFederationRequest { + // Required. The relative resource name of the location in which to create a federation + // service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Required. The ID of the metastore federation, which is used as the final + // component of the metastore federation's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore Federation to create. The `name` field is + // ignored. The ID of the created metastore federation must be + // provided in the request's `federation_id` field. + Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UpdateFederation. +message UpdateFederationRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore federation resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore federation to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore federation's `name` field is used to identify the + // metastore service to be updated. + Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteFederation. +message DeleteFederationRequest { + // Required. The relative resource name of the metastore federation to delete, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js new file mode 100644 index 00000000000..a1316624234 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backupId, backup) { + // [START metastore_v1_generated_DataprocMetastore_CreateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service in which to create a backup + * of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. The `name` field is ignored. The ID of the created + * backup must be provided in the request's `backup_id` field. + */ + // const backup = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await metastoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END metastore_v1_generated_DataprocMetastore_CreateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js new file mode 100644 index 00000000000..1f4be8c8ca9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, metadataImportId, metadataImport) { + // [START metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service in which to create a metastore + * import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metadata import, which is used as the final component of the + * metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const metadataImportId = 'abc123' + /** + * Required. The metadata import to create. The `name` field is ignored. The ID of the + * created metadata import must be provided in the request's + * `metadata_import_id` field. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateMetadataImport() { + // Construct request + const request = { + parent, + metadataImportId, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.createMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMetadataImport(); + // [END metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js new file mode 100644 index 00000000000..be6cf3f7c6a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, serviceId, service) { + // [START metastore_v1_generated_DataprocMetastore_CreateService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location in which to create a metastore + * service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const serviceId = 'abc123' + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateService() { + // Construct request + const request = { + parent, + serviceId, + service, + }; + + // Run request + const [operation] = await metastoreClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END metastore_v1_generated_DataprocMetastore_CreateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js new file mode 100644 index 00000000000..fdf75b78ecc --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastore_DeleteBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END metastore_v1_generated_DataprocMetastore_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js new file mode 100644 index 00000000000..8316d5b3dd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastore_DeleteService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteService() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END metastore_v1_generated_DataprocMetastore_DeleteService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js new file mode 100644 index 00000000000..c1bbc957915 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(service) { + // [START metastore_v1_generated_DataprocMetastore_ExportMetadata_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + */ + // const destinationGcsFolder = 'abc123' + /** + * Required. The relative resource name of the metastore service to run export, in the + * following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + /** + * Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. + */ + // const databaseDumpType = {} + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callExportMetadata() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await metastoreClient.exportMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportMetadata(); + // [END metastore_v1_generated_DataprocMetastore_ExportMetadata_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js new file mode 100644 index 00000000000..ff95621e3f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastore_GetBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END metastore_v1_generated_DataprocMetastore_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js new file mode 100644 index 00000000000..8e1e2ea66a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastore_GetMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metadata import to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetMetadataImport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getMetadataImport(request); + console.log(response); + } + + callGetMetadataImport(); + // [END metastore_v1_generated_DataprocMetastore_GetMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js new file mode 100644 index 00000000000..a2992042ab8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastore_GetService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetService() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getService(request); + console.log(response); + } + + callGetService(); + // [END metastore_v1_generated_DataprocMetastore_GetService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js new file mode 100644 index 00000000000..3cdac068efb --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1_generated_DataprocMetastore_ListBackups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of backups to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END metastore_v1_generated_DataprocMetastore_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js new file mode 100644 index 00000000000..10bc22ba6ea --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1_generated_DataprocMetastore_ListMetadataImports_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service whose metadata imports to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of imports to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListMetadataImports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listMetadataImportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMetadataImports(); + // [END metastore_v1_generated_DataprocMetastore_ListMetadataImports_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js new file mode 100644 index 00000000000..1d93595b5b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1_generated_DataprocMetastore_ListServices_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location of metastore services to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of services to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListServices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END metastore_v1_generated_DataprocMetastore_ListServices_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js new file mode 100644 index 00000000000..ab5ae593c52 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js @@ -0,0 +1,88 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(service, backup) { + // [START metastore_v1_generated_DataprocMetastore_RestoreService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to run restore, in the + * following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative resource name of the metastore service backup to restore + * from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const backup = 'abc123' + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + */ + // const restoreType = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRestoreService() { + // Construct request + const request = { + service, + backup, + }; + + // Run request + const [operation] = await metastoreClient.restoreService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreService(); + // [END metastore_v1_generated_DataprocMetastore_RestoreService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js new file mode 100644 index 00000000000..64d4a5dd7af --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, metadataImport) { + // [START metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateMetadataImport() { + // Construct request + const request = { + updateMask, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.updateMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMetadataImport(); + // [END metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js new file mode 100644 index 00000000000..296a7604fd4 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, service) { + // [START metastore_v1_generated_DataprocMetastore_UpdateService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateService() { + // Construct request + const request = { + updateMask, + service, + }; + + // Run request + const [operation] = await metastoreClient.updateService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateService(); + // [END metastore_v1_generated_DataprocMetastore_UpdateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js new file mode 100644 index 00000000000..0e7cd200044 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, federationId, federation) { + // [START metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location in which to create a federation + * service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const federationId = 'abc123' + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callCreateFederation() { + // Construct request + const request = { + parent, + federationId, + federation, + }; + + // Run request + const [operation] = await metastoreClient.createFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js new file mode 100644 index 00000000000..d1edfb692aa --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callDeleteFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js new file mode 100644 index 00000000000..e10d9d18c1c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore federation to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callGetFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getFederation(request); + console.log(response); + } + + callGetFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js new file mode 100644 index 00000000000..86ffdaf90bd --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callListFederations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listFederationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFederations(); + // [END metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js new file mode 100644 index 00000000000..182b7f8d9e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, federation) { + // [START metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callUpdateFederation() { + // Construct request + const request = { + updateMask, + federation, + }; + + // Run request + const [operation] = await metastoreClient.updateFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFederation(); + // [END metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json new file mode 100644 index 00000000000..5d670b3b566 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json @@ -0,0 +1,987 @@ +{ + "clientLibrary": { + "name": "nodejs-metastore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.metastore.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ListServices_async", + "title": "DataprocMetastore listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists services in a project and location.", + "canonical": true, + "file": "dataproc_metastore.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListServicesResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_GetService_async", + "title": "DataprocMetastore getService Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single service.", + "canonical": true, + "file": "dataproc_metastore.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.Service", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_CreateService_async", + "title": "DataprocMetastore createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore service in a project and location.", + "canonical": true, + "file": "dataproc_metastore.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_id", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateService_async", + "title": "DataprocMetastore updateService Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single service.", + "canonical": true, + "file": "dataproc_metastore.update_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteService_async", + "title": "DataprocMetastore deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single service.", + "canonical": true, + "file": "dataproc_metastore.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ListMetadataImports_async", + "title": "DataprocMetastore listMetadataImports Sample", + "origin": "API_DEFINITION", + "description": " Lists imports in a service.", + "canonical": true, + "file": "dataproc_metastore.list_metadata_imports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListMetadataImportsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_GetMetadataImport_async", + "title": "DataprocMetastore getMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single import.", + "canonical": true, + "file": "dataproc_metastore.get_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.MetadataImport", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async", + "title": "DataprocMetastore createMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Creates a new MetadataImport in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import_id", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async", + "title": "DataprocMetastore updateMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", + "canonical": true, + "file": "dataproc_metastore.update_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ExportMetadata_async", + "title": "DataprocMetastore exportMetadata Sample", + "origin": "API_DEFINITION", + "description": " Exports metadata from a service.", + "canonical": true, + "file": "dataproc_metastore.export_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", + "async": true, + "parameters": [ + { + "name": "destination_gcs_folder", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "database_dump_type", + "type": ".google.cloud.metastore.v1.DatabaseDumpSpec.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_RestoreService_async", + "title": "DataprocMetastore restoreService Sample", + "origin": "API_DEFINITION", + "description": " Restores a service from a backup.", + "canonical": true, + "file": "dataproc_metastore.restore_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + }, + { + "name": "restore_type", + "type": ".google.cloud.metastore.v1.Restore.RestoreType" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_ListBackups_async", + "title": "DataprocMetastore listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists backups in a service.", + "canonical": true, + "file": "dataproc_metastore.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListBackupsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_GetBackup_async", + "title": "DataprocMetastore getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single backup.", + "canonical": true, + "file": "dataproc_metastore.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.Backup", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_CreateBackup_async", + "title": "DataprocMetastore createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.metastore.v1.Backup" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteBackup_async", + "title": "DataprocMetastore deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single backup.", + "canonical": true, + "file": "dataproc_metastore.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async", + "title": "DataprocMetastore listFederations Sample", + "origin": "API_DEFINITION", + "description": " Lists federations in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.list_federations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.ListFederationsResponse", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async", + "title": "DataprocMetastore getFederation Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.get_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1.Federation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async", + "title": "DataprocMetastore createFederation Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore federation in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.create_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "federation_id", + "type": "TYPE_STRING" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async", + "title": "DataprocMetastore updateFederation Sample", + "origin": "API_DEFINITION", + "description": " Updates the fields of a federation.", + "canonical": true, + "file": "dataproc_metastore_federation.update_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async", + "title": "DataprocMetastore deleteFederation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.delete_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/index.ts new file mode 100644 index 00000000000..9a92fd523cf --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const DataprocMetastoreClient = v1.DataprocMetastoreClient; +type DataprocMetastoreClient = v1.DataprocMetastoreClient; +const DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; +type DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; +export {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +export default {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts new file mode 100644 index 00000000000..3aa11b4d2b7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts @@ -0,0 +1,3108 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/dataproc_metastore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore services. + * Metastore services are fully managed, highly available, autoscaled, + * autohealing, OSS-native deployments of technical metadata management + * software. Each metastore service exposes a network endpoint through which + * metadata queries are served. Metadata queries can originate from a variety + * of sources, including Apache Hive, Apache Presto, and Apache Spark. + * + * The Dataproc Metastore API defines the following resource model: + * + * * The service works with a collection of Google Cloud projects, named: + * `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * (a location must refer to a Google Cloud `region`) + * * Each location has a collection of services, named: `/services/*` + * * Dataproc Metastore services are resources with names of the form: + * + * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @class + * @memberof v1 + */ +export class DataprocMetastoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataprocMetastoreClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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 if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listMetadataImports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; + const createServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const updateServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; + const updateServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const deleteServiceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const createMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; + const createMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const updateMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; + const updateMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const exportMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.MetadataExport') as gax.protobuf.Type; + const exportMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const restoreServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Restore') as gax.protobuf.Type; + const restoreServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServiceResponse.decode.bind(createServiceResponse), + createServiceMetadata.decode.bind(createServiceMetadata)), + updateService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServiceResponse.decode.bind(updateServiceResponse), + updateServiceMetadata.decode.bind(updateServiceMetadata)), + deleteService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServiceResponse.decode.bind(deleteServiceResponse), + deleteServiceMetadata.decode.bind(deleteServiceMetadata)), + createMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMetadataImportResponse.decode.bind(createMetadataImportResponse), + createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), + updateMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), + updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), + exportMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportMetadataResponse.decode.bind(exportMetadataResponse), + exportMetadataMetadata.decode.bind(exportMetadataMetadata)), + restoreService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreServiceResponse.decode.bind(restoreServiceResponse), + restoreServiceMetadata.decode.bind(restoreServiceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1.DataprocMetastore', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataprocMetastoreStub) { + return this.dataprocMetastoreStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1.DataprocMetastore. + this.dataprocMetastoreStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastore') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1.DataprocMetastore, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataprocMetastoreStubMethods = + ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup']; + for (const methodName of dataprocMetastoreStubMethods) { + const callPromise = this.dataprocMetastoreStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'metastore.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets the details of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Service]{@link google.cloud.metastore.v1.Service}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.get_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_GetService_async + */ + getService( + request?: protos.google.cloud.metastore.v1.IGetServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined + ]>; + getService( + request: protos.google.cloud.metastore.v1.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request: protos.google.cloud.metastore.v1.IGetServiceRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request?: protos.google.cloud.metastore.v1.IGetServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IService, + protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } +/** + * Gets details of a single import. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metadata import to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.get_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_GetMetadataImport_async + */ + getMetadataImport( + request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|undefined, {}|undefined + ]>; + getMetadataImport( + request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport, + protos.google.cloud.metastore.v1.IGetMetadataImportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getMetadataImport(request, options, callback); + } +/** + * Gets details of a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.cloud.metastore.v1.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.get_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.metastore.v1.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.metastore.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.metastore.v1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.metastore.v1.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IBackup, + protos.google.cloud.metastore.v1.IGetBackupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBackup(request, options, callback); + } + +/** + * Creates a metastore service in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a metastore + * service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.serviceId + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1.Service} request.service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async + */ + createService( + request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createService( + request: protos.google.cloud.metastore.v1.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request: protos.google.cloud.metastore.v1.ICreateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async + */ + async checkCreateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1.Service} request.service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async + */ + updateService( + request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateService( + request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async + */ + async checkUpdateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async + */ + deleteService( + request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteService( + request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async + */ + async checkDeleteServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new MetadataImport in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a metastore + * import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.metadataImportId + * Required. The ID of the metadata import, which is used as the final component of the + * metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport + * Required. The metadata import to create. The `name` field is ignored. The ID of the + * created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async + */ + createMetadataImport( + request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMetadataImport( + request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async + */ + async checkCreateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async + */ + updateMetadataImport( + request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMetadataImport( + request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metadata_import.name': request.metadataImport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async + */ + async checkUpdateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports metadata from a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run export, in the + * following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {google.cloud.metastore.v1.DatabaseDumpSpec.Type} [request.databaseDumpType] + * Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async + */ + exportMetadata( + request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportMetadata( + request: protos.google.cloud.metastore.v1.IExportMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request: protos.google.cloud.metastore.v1.IExportMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async + */ + async checkExportMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a service from a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run restore, in the + * following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backup + * Required. The relative resource name of the metastore service backup to restore + * from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {google.cloud.metastore.v1.Restore.RestoreType} [request.restoreType] + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.restore_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async + */ + restoreService( + request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreService( + request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.restore_service.js + * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async + */ + async checkRestoreServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new backup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a backup + * of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backupId + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1.Backup} request.backup + * Required. The backup to create. The `name` field is ignored. The ID of the created + * backup must be provided in the request's `backup_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.metastore.v1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.metastore.v1.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.create_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists services in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.metastore.v1.Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServices( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IService[], + protos.google.cloud.metastore.v1.IListServicesRequest|null, + protos.google.cloud.metastore.v1.IListServicesResponse + ]>; + listServices( + request: protos.google.cloud.metastore.v1.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>): void; + listServices( + request: protos.google.cloud.metastore.v1.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>): void; + listServices( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListServicesRequest, + protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1.IService>): + Promise<[ + protos.google.cloud.metastore.v1.IService[], + protos.google.cloud.metastore.v1.IListServicesRequest|null, + protos.google.cloud.metastore.v1.IListServicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.cloud.metastore.v1.Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServicesStream( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Service]{@link google.cloud.metastore.v1.Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.list_services.js + * region_tag:metastore_v1_generated_DataprocMetastore_ListServices_async + */ + listServicesAsync( + request?: protos.google.cloud.metastore.v1.IListServicesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists imports in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetadataImports( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport[], + protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse + ]>; + listMetadataImports( + request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>): void; + listMetadataImports( + request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>): void; + listMetadataImports( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1.IMetadataImport>): + Promise<[ + protos.google.cloud.metastore.v1.IMetadataImport[], + protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1.IListMetadataImportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listMetadataImports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetadataImportsStream( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.createStream( + this.innerApiCalls.listMetadataImports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMetadataImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.list_metadata_imports.js + * region_tag:metastore_v1_generated_DataprocMetastore_ListMetadataImports_async + */ + listMetadataImportsAsync( + request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.asyncIterate( + this.innerApiCalls['listMetadataImports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists backups in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Backup]{@link google.cloud.metastore.v1.Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IBackup[], + protos.google.cloud.metastore.v1.IListBackupsRequest|null, + protos.google.cloud.metastore.v1.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.metastore.v1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>): void; + listBackups( + request: protos.google.cloud.metastore.v1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>): void; + listBackups( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListBackupsRequest, + protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1.IBackup>): + Promise<[ + protos.google.cloud.metastore.v1.IBackup[], + protos.google.cloud.metastore.v1.IListBackupsRequest|null, + protos.google.cloud.metastore.v1.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Backup]{@link google.cloud.metastore.v1.Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.cloud.metastore.v1.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore.list_backups.js + * region_tag:metastore_v1_generated_DataprocMetastore_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.metastore.v1.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataprocMetastoreStub && !this._terminated) { + return this.dataprocMetastoreStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json new file mode 100644 index 00000000000..34a71622ee4 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json @@ -0,0 +1,113 @@ +{ + "interfaces": { + "google.cloud.metastore.v1.DataprocMetastore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts new file mode 100644 index 00000000000..6fe2bcd5627 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts @@ -0,0 +1,1725 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/dataproc_metastore_federation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore federation services. + * Dataproc Metastore Federation Service allows federating a collection of + * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc + * Metastores. The Federation Service exposes a gRPC URL through which metadata + * from the backend metastores are served at query time. + * + * The Dataproc Metastore Federation API defines the following resource model: + * * The service works with a collection of Google Cloud projects. + * * Each project has a collection of available locations. + * * Each location has a collection of federations. + * * Dataproc Metastore Federations are resources with names of the + * form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @class + * @memberof v1 + */ +export class DataprocMetastoreFederationClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreFederationClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataprocMetastoreFederationClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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 if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listFederations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; + const createFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const updateFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; + const updateFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + const deleteFederationResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFederationResponse.decode.bind(createFederationResponse), + createFederationMetadata.decode.bind(createFederationMetadata)), + updateFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFederationResponse.decode.bind(updateFederationResponse), + updateFederationMetadata.decode.bind(updateFederationMetadata)), + deleteFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFederationResponse.decode.bind(deleteFederationResponse), + deleteFederationMetadata.decode.bind(deleteFederationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1.DataprocMetastoreFederation', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataprocMetastoreFederationStub) { + return this.dataprocMetastoreFederationStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1.DataprocMetastoreFederation. + this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastoreFederation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1.DataprocMetastoreFederation, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataprocMetastoreFederationStubMethods = + ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; + for (const methodName of dataprocMetastoreFederationStubMethods) { + const callPromise = this.dataprocMetastoreFederationStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreFederationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'metastore.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets the details of a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Federation]{@link google.cloud.metastore.v1.Federation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.get_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async + */ + getFederation( + request?: protos.google.cloud.metastore.v1.IGetFederationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|undefined, {}|undefined + ]>; + getFederation( + request: protos.google.cloud.metastore.v1.IGetFederationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request: protos.google.cloud.metastore.v1.IGetFederationRequest, + callback: Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request?: protos.google.cloud.metastore.v1.IGetFederationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1.IFederation, + protos.google.cloud.metastore.v1.IGetFederationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFederation(request, options, callback); + } + +/** + * Creates a metastore federation in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a federation + * service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.federationId + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1.Federation} request.federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async + */ + createFederation( + request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFederation( + request: protos.google.cloud.metastore.v1.ICreateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request: protos.google.cloud.metastore.v1.ICreateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async + */ + async checkCreateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the fields of a federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1.Federation} request.federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + updateFederation( + request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFederation( + request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'federation.name': request.federation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + async checkUpdateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + deleteFederation( + request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFederation( + request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + async checkDeleteFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists federations in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Federation]{@link google.cloud.metastore.v1.Federation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFederations( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1.IFederation[], + protos.google.cloud.metastore.v1.IListFederationsRequest|null, + protos.google.cloud.metastore.v1.IListFederationsResponse + ]>; + listFederations( + request: protos.google.cloud.metastore.v1.IListFederationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>): void; + listFederations( + request: protos.google.cloud.metastore.v1.IListFederationsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>): void; + listFederations( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1.IListFederationsRequest, + protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1.IFederation>): + Promise<[ + protos.google.cloud.metastore.v1.IFederation[], + protos.google.cloud.metastore.v1.IListFederationsRequest|null, + protos.google.cloud.metastore.v1.IListFederationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFederations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Federation]{@link google.cloud.metastore.v1.Federation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFederationsStream( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.createStream( + this.innerApiCalls.listFederations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFederations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Federation]{@link google.cloud.metastore.v1.Federation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/dataproc_metastore_federation.list_federations.js + * region_tag:metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async + */ + listFederationsAsync( + request?: protos.google.cloud.metastore.v1.IListFederationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.asyncIterate( + this.innerApiCalls['listFederations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataprocMetastoreFederationStub && !this._terminated) { + return this.dataprocMetastoreFederationStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json new file mode 100644 index 00000000000..71c66a13e4c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.metastore.v1.DataprocMetastoreFederation": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListFederations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json new file mode 100644 index 00000000000..76860a15e6b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1/metastore.proto", + "../../protos/google/cloud/metastore/v1/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json new file mode 100644 index 00000000000..76860a15e6b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1/metastore.proto", + "../../protos/google/cloud/metastore/v1/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..0e5fffd2771 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json @@ -0,0 +1,253 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.metastore.v1", + "libraryPackage": "@google-cloud/dataproc-metastore", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts new file mode 100644 index 00000000000..3e1ee876b29 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {DataprocMetastoreClient} from './dataproc_metastore_client'; +export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..74e7a6657af --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const metastore = require('@google-cloud/dataproc-metastore'); + +function main() { + const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); + const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..f10cef1cd2c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; + +// check that the client class type name can be used +function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { + client.close(); +} +function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dataprocMetastoreClient = new DataprocMetastoreClient(); + doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); + // check that the client instance can be created + const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts new file mode 100644 index 00000000000..e97240ab9b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts @@ -0,0 +1,2000 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as dataprocmetastorefederationModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.DataprocMetastoreFederationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreFederationStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreFederationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getFederation', () => { + it('invokes getFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); + const [response] = await client.getFederation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFederation( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with closed client', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFederation(request), expectedError); + }); + }); + + describe('createFederation', () => { + it('invokes createFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFederation', () => { + it('invokes updateFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFederation', () => { + it('invokes deleteFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFederations', () => { + it('invokes listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); + const [response] = await client.listFederations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFederations( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFederations(request), expectedError); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederationsStream without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFederationsStream with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), + ]; + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IFederation[] = []; + const iterable = client.listFederationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFederationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IFederation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts new file mode 100644 index 00000000000..91ddbfd4506 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts @@ -0,0 +1,3672 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as dataprocmetastoreModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.DataprocMetastoreClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastoreModule.v1.DataprocMetastoreClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastoreModule.v1.DataprocMetastoreClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastoreModule.v1.DataprocMetastoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getService', () => { + it('invokes getService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Service() + ); + client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('getMetadataImport', () => { + it('invokes getMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); + const [response] = await client.getMetadataImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetadataImport( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with closed client', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetadataImport(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); + const [operation] = await client.createService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createMetadataImport', () => { + it('invokes createMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMetadataImport', () => { + it('invokes updateMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportMetadata', () => { + it('invokes exportMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreService', () => { + it('invokes restoreService without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreService(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMetadataImports', () => { + it('invokes listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); + const [response] = await client.listMetadataImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetadataImports( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMetadataImports(request), expectedError); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImportsStream without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMetadataImportsStream with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; + const iterable = client.listMetadataImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetadataImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js new file mode 100644 index 00000000000..6fc45cb3d30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'DataprocMetastore', + filename: './dataproc-metastore.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js new file mode 100644 index 00000000000..bc8b6fc164f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dataproc-metastore', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/README.md b/owl-bot-staging/google-cloud-metastore/v1alpha/README.md new file mode 100644 index 00000000000..24afb9017c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/README.md @@ -0,0 +1 @@ +Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/package.json b/owl-bot-staging/google-cloud-metastore/v1alpha/package.json new file mode 100644 index 00000000000..b3e0a6424ad --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/dataproc-metastore", + "version": "0.1.0", + "description": "Metastore client for Node.js", + "repository": "googleapis/nodejs-metastore", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google metastore", + "metastore", + "dataproc metastore", + "dataproc metastore federation" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto new file mode 100644 index 00000000000..3cac5b5abc7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto @@ -0,0 +1,1462 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.metastore.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/dayofweek.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha;metastore"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreProto"; +option java_package = "com.google.cloud.metastore.v1alpha"; +option php_namespace = "Google\\Cloud\\Metastore\\V1alpha"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Subnetwork" + pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" +}; +option (google.api.resource_definition) = { + type: "dataplex.googleapis.com/Lake" + pattern: "projects/{project}/locations/{location}/lakes/{lake}" +}; + +// Configures and manages metastore services. +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management +// software. Each metastore service exposes a network endpoint through which +// metadata queries are served. Metadata queries can originate from a variety +// of sources, including Apache Hive, Apache Presto, and Apache Spark. +// +// The Dataproc Metastore API defines the following resource model: +// +// * The service works with a collection of Google Cloud projects, named: +// `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// (a location must refer to a Google Cloud `region`) +// * Each location has a collection of services, named: `/services/*` +// * Dataproc Metastore services are resources with names of the form: +// +// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. +service DataprocMetastore { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists services in a project and location. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore service in a project and location. + rpc CreateService(CreateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Updates the parameters of a single service. + rpc UpdateService(UpdateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{service.name=projects/*/locations/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Deletes a single service. + rpc DeleteService(DeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Lists imports in a service. + rpc ListMetadataImports(ListMetadataImportsRequest) + returns (ListMetadataImportsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single import. + rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/services/*/metadataImports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new MetadataImport in a given project and location. + rpc CreateMetadataImport(CreateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" + body: "metadata_import" + }; + option (google.api.method_signature) = + "parent,metadata_import,metadata_import_id"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Updates a single import. + // Only the description field of MetadataImport is supported to be updated. + rpc UpdateMetadataImport(UpdateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" + body: "metadata_import" + }; + option (google.api.method_signature) = "metadata_import,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Exports metadata from a service. + rpc ExportMetadata(ExportMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:exportMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MetadataExport" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Restores a service from a backup. + rpc RestoreService(RestoreServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{service=projects/*/locations/*/services/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "service,backup"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Lists backups in a service. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new backup in a given project and location. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Deletes a single backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } +} + +// A managed metastore service that serves metadata queries. +message Service { + option (google.api.resource) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + }; + + // The current state of the metastore service. + enum State { + // The state of the metastore service is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore service is in the process of being created. + CREATING = 1; + + // The metastore service is running and ready to serve queries. + ACTIVE = 2; + + // The metastore service is entering suspension. Its query-serving + // availability may cease unexpectedly. + SUSPENDING = 3; + + // The metastore service is suspended and unable to serve queries. + SUSPENDED = 4; + + // The metastore service is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 5; + + // The metastore service is undergoing deletion. It cannot be used. + DELETING = 6; + + // The metastore service has encountered an error and cannot be used. The + // metastore service should be deleted. + ERROR = 7; + } + + // Available service tiers. + enum Tier { + // The tier is not set. + TIER_UNSPECIFIED = 0; + + // The developer tier provides limited scalability and no fault tolerance. + // Good for low-cost proof-of-concept. + DEVELOPER = 1; + + // The enterprise tier provides multi-zone high availability, and sufficient + // scalability for enterprise-level Dataproc Metastore workloads. + ENTERPRISE = 3; + } + + // Release channels bundle features of varying levels of stability. Newer + // features may be introduced initially into less stable release channels and + // can be automatically promoted into more stable release channels. + enum ReleaseChannel { + // Release channel is not specified. + RELEASE_CHANNEL_UNSPECIFIED = 0; + + // The `CANARY` release channel contains the newest features, which may be + // unstable and subject to unresolved issues with no known workarounds. + // Services using the `CANARY` release channel are not subject to any SLAs. + CANARY = 1; + + // The `STABLE` release channel contains features that are considered stable + // and have been validated for production use. + STABLE = 2; + } + + // The backend database type for the metastore service. + enum DatabaseType { + // The DATABASE_TYPE is not set. + DATABASE_TYPE_UNSPECIFIED = 0; + + // MySQL is used to persist the metastore data. + MYSQL = 1; + + // Spanner is used to persist the metastore data. + SPANNER = 2; + } + + // Configuration properties specific to the underlying metastore service + // technology (the software that serves metastore queries). + oneof metastore_config { + // Configuration information specific to running Hive metastore + // software as the metastore service. + HiveMetastoreConfig hive_metastore_config = 5; + } + + // Immutable. The relative resource name of the metastore service, in the + // following format: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore service was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore service was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore service. + map labels = 4; + + // Immutable. The relative resource name of the VPC network on which the + // instance can be accessed. It is specified in the following form: + // + // `projects/{project_number}/global/networks/{network_id}`. + string network = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The TCP port at which the metastore service is reached. Default: 9083. + int32 port = 9; + + // Output only. The current state of the metastore service. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore service, if available. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A Cloud Storage URI (starting with `gs://`) that specifies + // where artifacts related to the metastore service are stored. + string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The tier of the service. + Tier tier = 13; + + // The setting that defines how metastore metadata should be integrated with + // external services and systems. + MetadataIntegration metadata_integration = 14; + + // The one hour maintenance window of the metastore service. This specifies + // when the service can be restarted for maintenance purposes in UTC time. + // Maintenance window is not needed for services with the SPANNER + // database type. + MaintenanceWindow maintenance_window = 15; + + // Output only. The globally unique resource identifier of the metastore + // service. + string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The metadata management activities of the metastore service. + MetadataManagementActivity metadata_management_activity = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The release channel of the service. + // If unspecified, defaults to `STABLE`. + ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Information used to configure the Dataproc Metastore service to + // encrypt customer data at rest. Cannot be updated. + EncryptionConfig encryption_config = 20 + [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying the network settings for the + // Dataproc Metastore service. + NetworkConfig network_config = 21; + + // Immutable. The database type that the Metastore service stores its data. + DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying telemetry settings for the Dataproc Metastore + // service. If unspecified defaults to `JSON`. + TelemetryConfig telemetry_config = 23; +} + +// Specifies how metastore metadata should be integrated with external services. +message MetadataIntegration { + // The integration config for the Data Catalog service. + DataCatalogConfig data_catalog_config = 1; + + // The integration config for the Dataplex service. + DataplexConfig dataplex_config = 2; +} + +// Specifies how metastore metadata should be integrated with the Data Catalog +// service. +message DataCatalogConfig { + // Defines whether the metastore metadata should be synced to Data Catalog. + // The default value is to disable syncing metastore metadata to Data Catalog. + bool enabled = 2; +} + +// Specifies how metastore metadata should be integrated with the Dataplex +// service. +message DataplexConfig { + // A reference to the Lake resources that this metastore service is attached + // to. The key is the lake resource name. Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + map lake_resources = 1; +} + +// Represents a Lake resource +message Lake { + // The Lake resource name. + // Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + string name = 1 [ + (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } + ]; +} + +// Maintenance window. This specifies when Dataproc Metastore +// may perform system maintenance operation to the service. +message MaintenanceWindow { + // The hour of day (0-23) when the window starts. + google.protobuf.Int32Value hour_of_day = 1; + + // The day of week, when the window starts. + google.type.DayOfWeek day_of_week = 2; +} + +// Specifies configuration information specific to running Hive metastore +// software as the metastore service. +message HiveMetastoreConfig { + // Protocols available for serving the metastore service endpoint. + enum EndpointProtocol { + // The protocol is not set. + ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + + // Use the legacy Apache Thrift protocol for the metastore service endpoint. + THRIFT = 1; + + // Use the modernized gRPC protocol for the metastore service endpoint. + GRPC = 2; + } + + // Immutable. The Hive metastore schema version. + string version = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // Hive metastore (configured in `hive-site.xml`). The mappings + // override system defaults (some keys cannot be overridden). These + // overrides are also applied to auxiliary versions and can be further + // customized in the auxiliary version's `AuxiliaryVersionConfig`. + map config_overrides = 2; + + // Information used to configure the Hive metastore service as a service + // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + // method and specify this field's path + // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + // while omitting this field from the request's `service`. + KerberosConfig kerberos_config = 3; + + // The protocol to use for the metastore service endpoint. If unspecified, + // defaults to `THRIFT`. + EndpointProtocol endpoint_protocol = 4; + + // A mapping of Hive metastore version to the auxiliary version + // configuration. When specified, a secondary Hive metastore service is + // created along with the primary service. All auxiliary versions must be less + // than the service's primary version. The key is the auxiliary service name + // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + // means that the first character must be a lowercase letter, and all the + // following characters must be hyphens, lowercase letters, or digits, except + // the last character, which cannot be a hyphen. + map auxiliary_versions = 5; +} + +// Configuration information for a Kerberos principal. +message KerberosConfig { + // A Kerberos keytab file that can be used to authenticate a service principal + // with a Kerberos Key Distribution Center (KDC). + Secret keytab = 1; + + // A Kerberos principal that exists in the both the keytab the KDC + // to authenticate as. A typical principal is of the form + // `primary/instance@REALM`, but there is no exact format. + string principal = 2; + + // A Cloud Storage URI that specifies the path to a + // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + // although the file does not need to be named krb5.conf explicitly. + string krb5_config_gcs_uri = 3; +} + +// A securely stored value. +message Secret { + oneof value { + // The relative resource name of a Secret Manager secret version, in the + // following form: + // + // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + string cloud_secret = 2; + } +} + +// Encryption settings for the service. +message EncryptionConfig { + // The fully qualified customer provided Cloud KMS key name to use for + // customer data encryption, in the following form: + // + // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + string kms_key = 1; +} + +// Configuration information for the auxiliary service versions. +message AuxiliaryVersionConfig { + // The Hive metastore version of the auxiliary service. It must be less + // than the primary Hive metastore service's version. + string version = 1; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + // the primary version's overrides. If keys are present in both the auxiliary + // version's overrides and the primary version's overrides, the value from + // the auxiliary version's overrides takes precedence. + map config_overrides = 2; + + // Output only. The network configuration contains the endpoint URI(s) of the + // auxiliary Hive metastore service. + NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network configuration for the Dataproc Metastore service. +message NetworkConfig { + // Contains information of the customer's network configurations. + message Consumer { + oneof vpc_resource { + // Immutable. The subnetwork of the customer project from which an IP + // address is reserved and used as the Dataproc Metastore service's + // endpoint. It is accessible to hosts in the subnet and to all + // hosts in a subnet in the same region and same network. There must + // be at least one IP address available in the subnet's primary range. The + // subnet is specified in the following form: + // + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id} + string subnetwork = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Subnetwork" + } + ]; + } + + // Output only. The URI of the endpoint used to access the metastore + // service. + string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Immutable. The consumer-side network configuration for the Dataproc + // Metastore instance. + repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// Telemetry Configuration for the Dataproc Metastore service. +message TelemetryConfig { + enum LogFormat { + // The LOG_FORMAT is not set. + LOG_FORMAT_UNSPECIFIED = 0; + + // Logging output uses the legacy `textPayload` format. + LEGACY = 1; + + // Logging output uses the `jsonPayload` format. + JSON = 2; + } + + // The output format of the Dataproc Metastore service's logs. + LogFormat log_format = 1; +} + +// The metadata management activities of the metastore service. +message MetadataManagementActivity { + // Output only. The latest metadata exports of the metastore service. + repeated MetadataExport metadata_exports = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The latest restores of the metastore service. + repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A metastore resource that imports metadata. +message MetadataImport { + option (google.api.resource) = { + type: "metastore.googleapis.com/MetadataImport" + pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" + }; + + // A specification of the location of and metadata about a database dump from + // a relational database management system. + message DatabaseDump { + // The type of the database. + enum DatabaseType { + // The type of the source database is unknown. + DATABASE_TYPE_UNSPECIFIED = 0; + + // The type of the source database is MySQL. + MYSQL = 1; + } + + // The type of the database. + DatabaseType database_type = 1 [deprecated = true]; + + // A Cloud Storage object or folder URI that specifies the source from which + // to import metadata. It must begin with `gs://`. + string gcs_uri = 2; + + // The name of the source database. + string source_database = 3 [deprecated = true]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The current state of the metadata import. + enum State { + // The state of the metadata import is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata import is running. + RUNNING = 1; + + // The metadata import completed successfully. + SUCCEEDED = 2; + + // The metadata import is being updated. + UPDATING = 3; + + // The metadata import failed, and attempted metadata changes were rolled + // back. + FAILED = 4; + } + + // The metadata to be imported. + oneof metadata { + // Immutable. A database dump from a pre-existing metastore's database. + DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Immutable. The relative resource name of the metadata import, of the form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The description of the metadata import. + string description = 2; + + // Output only. The time when the metadata import was started. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import finished. + google.protobuf.Timestamp end_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the metadata import. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata export operation. +message MetadataExport { + // The current state of the metadata export. + enum State { + // The state of the metadata export is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata export is running. + RUNNING = 1; + + // The metadata export completed successfully. + SUCCEEDED = 2; + + // The metadata export failed. + FAILED = 3; + + // The metadata export is cancelled. + CANCELLED = 4; + } + + oneof destination { + // Output only. A Cloud Storage URI of a folder that metadata are exported + // to, in the form of + // `gs:////`, where + // `` is automatically generated. + string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The time when the export started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the export ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the export. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the database dump. + DatabaseDumpSpec.Type database_dump_type = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a backup resource. +message Backup { + option (google.api.resource) = { + type: "metastore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" + }; + + // The current state of the backup. + enum State { + // The state of the backup is unknown. + STATE_UNSPECIFIED = 0; + + // The backup is being created. + CREATING = 1; + + // The backup is being deleted. + DELETING = 2; + + // The backup is active and ready to use. + ACTIVE = 3; + + // The backup failed. + FAILED = 4; + + // The backup is being restored. + RESTORING = 5; + } + + // Immutable. The relative resource name of the backup, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the backup was started. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup finished creating. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the service at the time of backup. + Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the backup. + string description = 6; + + // Output only. Services that are restoring from the backup. + repeated string restoring_services = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata restore operation. +message Restore { + // The current state of the restore. + enum State { + // The state of the metadata restore is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata restore is running. + RUNNING = 1; + + // The metadata restore completed successfully. + SUCCEEDED = 2; + + // The metadata restore failed. + FAILED = 3; + + // The metadata restore is cancelled. + CANCELLED = 4; + } + + // The type of restore. If unspecified, defaults to `METADATA_ONLY`. + enum RestoreType { + // The restore type is unknown. + RESTORE_TYPE_UNSPECIFIED = 0; + + // The service's metadata and configuration are restored. + FULL = 1; + + // Only the service's metadata is restored. + METADATA_ONLY = 2; + } + + // Output only. The time when the restore started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the restore ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the restore. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Output only. The type of restore. + RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The restore details containing the revision of the service to + // be restored to, in format of JSON. + string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. +message ListServicesRequest { + // Required. The relative resource name of the location of metastore services + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of services to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. +message ListServicesResponse { + // The services in the specified location. + repeated Service services = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetService][google.cloud.metastore.v1alpha.DataprocMetastore.GetService]. +message GetServiceRequest { + // Required. The relative resource name of the metastore service to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateService][google.cloud.metastore.v1alpha.DataprocMetastore.CreateService]. +message CreateServiceRequest { + // Required. The relative resource name of the location in which to create a + // metastore service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The ID of the metastore service, which is used as the final + // component of the metastore service's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore service to create. The `name` field is + // ignored. The ID of the created metastore service must be provided in + // the request's `service_id` field. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateService][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService]. +message UpdateServiceRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore service resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore service to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore service's `name` field is used to identify the metastore + // service to be updated. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteService][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService]. +message DeleteServiceRequest { + // Required. The relative resource name of the metastore service to delete, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsRequest { + // Required. The relative resource name of the service whose metadata imports + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Optional. The maximum number of imports to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 imports are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsResponse { + // The imports in the specified service. + repeated MetadataImport metadata_imports = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport]. +message GetMetadataImportRequest { + // Required. The relative resource name of the metadata import to retrieve, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/MetadataImport" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport]. +message CreateMetadataImportRequest { + // Required. The relative resource name of the service in which to create a + // metastore import, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Required. The ID of the metadata import, which is used as the final + // component of the metadata import's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to create. The `name` field is ignored. The + // ID of the created metadata import must be provided in the request's + // `metadata_import_id` field. + MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport]. +message UpdateMetadataImportRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metadata import resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to update. The server only merges fields + // in the import if they are specified in `update_mask`. + // + // The metadata import's `name` field is used to identify the metastore + // import to be updated. + MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. +message ListBackupsRequest { + // Required. The relative resource name of the service whose backups to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The maximum number of backups to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 backups are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. +message ListBackupsResponse { + // The backups of the specified service. + repeated Backup backups = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetBackup][google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup]. +message GetBackupRequest { + // Required. The relative resource name of the backup to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup]. +message CreateBackupRequest { + // Required. The relative resource name of the service in which to create a + // backup of the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Required. The ID of the backup, which is used as the final component of the + // backup's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. The `name` field is ignored. The ID of the + // created backup must be provided in the request's `backup_id` field. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup]. +message DeleteBackupRequest { + // Required. The relative resource name of the backup to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata]. +message ExportMetadataRequest { + // Required. Destination that metadata is exported to. + oneof destination { + // A Cloud Storage URI of a folder, in the format + // `gs:///`. A sub-folder + // `` containing exported files will be created below it. + string destination_gcs_folder = 2; + } + + // Required. The relative resource name of the metastore service to run + // export, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type database_dump_type = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.Restore][]. +message RestoreServiceRequest { + // Required. The relative resource name of the metastore service to run + // restore, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the caller has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata about the service in a location. +message LocationMetadata { + // A specification of a supported version of the Hive Metastore software. + message HiveMetastoreVersion { + // The semantic version of the Hive Metastore software. + string version = 1; + + // Whether `version` will be chosen by the server if a metastore service is + // created with a `HiveMetastoreConfig` that omits the `version`. + bool is_default = 2; + } + + // The versions of Hive Metastore that can be used when creating a new + // metastore service in this location. The server guarantees that exactly one + // `HiveMetastoreVersion` in the list will set `is_default`. + repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; +} + +// The specification of database dump to import from or export to. +message DatabaseDumpSpec { + // The type of the database dump. + enum Type { + // The type of the database dump is unknown. + TYPE_UNSPECIFIED = 0; + + // Database dump is a MySQL dump file. + MYSQL = 1; + + // Database dump contains Avro files. + AVRO = 2; + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto new file mode 100644 index 00000000000..d4f07335455 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto @@ -0,0 +1,364 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.metastore.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha;metastore"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreFederationProto"; +option java_package = "com.google.cloud.metastore.v1alpha"; + +// Configures and manages metastore federation services. +// Dataproc Metastore Federation Service allows federating a collection of +// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc +// Metastores. The Federation Service exposes a gRPC URL through which metadata +// from the backend metastores are served at query time. +// +// The Dataproc Metastore Federation API defines the following resource model: +// * The service works with a collection of Google Cloud projects. +// * Each project has a collection of available locations. +// * Each location has a collection of federations. +// * Dataproc Metastore Federations are resources with names of the +// form: +// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. +service DataprocMetastoreFederation { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists federations in a project and location. + rpc ListFederations(ListFederationsRequest) returns (ListFederationsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*}/federations" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single federation. + rpc GetFederation(GetFederationRequest) returns (Federation) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore federation in a project and location. + rpc CreateFederation(CreateFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*}/federations" + body: "federation" + }; + option (google.api.method_signature) = "parent,federation,federation_id"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Updates the fields of a federation. + rpc UpdateFederation(UpdateFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha/{federation.name=projects/*/locations/*/federations/*}" + body: "federation" + }; + option (google.api.method_signature) = "federation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } + + // Deletes a single federation. + rpc DeleteFederation(DeleteFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" + }; + } +} + +// Represents a federation of multiple backend metastores. +message Federation { + option (google.api.resource) = { + type: "metastore.googleapis.com/Federation" + pattern: "projects/{project}/locations/{location}/federations/{federation}" + }; + + // The current state of the federation. + enum State { + // The state of the metastore federation is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore federation is in the process of being created. + CREATING = 1; + + // The metastore federation is running and ready to serve queries. + ACTIVE = 2; + + // The metastore federation is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 3; + + // The metastore federation is undergoing deletion. It cannot be used. + DELETING = 4; + + // The metastore federation has encountered an error and cannot be used. The + // metastore federation should be deleted. + ERROR = 5; + } + + // Immutable. The relative resource name of the federation, of the + // form: + // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore federation was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore federation was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore federation. + map labels = 4; + + // Immutable. The Apache Hive metastore version of the federation. All backend metastore + // versions must be compatible with the federation version. + string version = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // A map from `BackendMetastore` rank to `BackendMetastore`s from which the + // federation service serves metadata at query time. The map key represents + // the order in which `BackendMetastore`s should be evaluated to resolve + // database names at query time and should be greater than or equal to zero. A + // `BackendMetastore` with a lower number will be evaluated before a + // `BackendMetastore` with a higher number. + map backend_metastores = 6; + + // Output only. The federation endpoint. + string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the federation. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the metastore federation, + // if available. + string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The globally unique resource identifier of the metastore federation. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a backend metastore for the federation. +message BackendMetastore { + // The type of the backend metastore. + enum MetastoreType { + // The metastore type is not set. + METASTORE_TYPE_UNSPECIFIED = 0; + + // The backend metastore is BigQuery. + BIGQUERY = 2; + + // The backend metastore is Dataproc Metastore. + DATAPROC_METASTORE = 3; + } + + // The relative resource name of the metastore that is being federated. + // The formats of the relative resource names for the currently supported + // metastores are listed below: + // + // * Dataplex + // * `projects/{project_id}/locations/{location}/lakes/{lake_id}` + // * BigQuery + // * `projects/{project_id}` + // * Dataproc Metastore + // * `projects/{project_id}/locations/{location}/services/{service_id}` + string name = 1; + + // The type of the backend metastore. + MetastoreType metastore_type = 2; +} + +// Request message for ListFederations. +message ListFederationsRequest { + // Required. The relative resource name of the location of metastore federations + // to list, in the following form: + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. The maximum number of federations to return. The response may contain less + // than the maximum number. If unspecified, no more than 500 services are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous ListFederationServices + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // ListFederationServices must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListFederations +message ListFederationsResponse { + // The services in the specified location. + repeated Federation federations = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetFederation. +message GetFederationRequest { + // Required. The relative resource name of the metastore federation to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; +} + +// Request message for CreateFederation. +message CreateFederationRequest { + // Required. The relative resource name of the location in which to create a federation + // service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Required. The ID of the metastore federation, which is used as the final + // component of the metastore federation's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore Federation to create. The `name` field is + // ignored. The ID of the created metastore federation must be + // provided in the request's `federation_id` field. + Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UpdateFederation. +message UpdateFederationRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore federation resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore federation to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore federation's `name` field is used to identify the + // metastore service to be updated. + Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteFederation. +message DeleteFederationRequest { + // Required. The relative resource name of the metastore federation to delete, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js new file mode 100644 index 00000000000..46f14e978db --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backupId, backup) { + // [START metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + */ + // const backup = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await metastoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js new file mode 100644 index 00000000000..160570c1d9b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, metadataImportId, metadataImport) { + // [START metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const metadataImportId = 'abc123' + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateMetadataImport() { + // Construct request + const request = { + parent, + metadataImportId, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.createMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMetadataImport(); + // [END metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js new file mode 100644 index 00000000000..1a2911e08ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, serviceId, service) { + // [START metastore_v1alpha_generated_DataprocMetastore_CreateService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const serviceId = 'abc123' + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateService() { + // Construct request + const request = { + parent, + serviceId, + service, + }; + + // Run request + const [operation] = await metastoreClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END metastore_v1alpha_generated_DataprocMetastore_CreateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js new file mode 100644 index 00000000000..e51c754d667 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js new file mode 100644 index 00000000000..aafdab8ffc7 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_DeleteService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteService() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END metastore_v1alpha_generated_DataprocMetastore_DeleteService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js new file mode 100644 index 00000000000..b8acec0f0a1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js @@ -0,0 +1,88 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(service) { + // [START metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + */ + // const destinationGcsFolder = 'abc123' + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + */ + // const databaseDumpType = {} + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callExportMetadata() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await metastoreClient.exportMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportMetadata(); + // [END metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js new file mode 100644 index 00000000000..71242ecb098 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_GetBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END metastore_v1alpha_generated_DataprocMetastore_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js new file mode 100644 index 00000000000..25803bf327b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetMetadataImport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getMetadataImport(request); + console.log(response); + } + + callGetMetadataImport(); + // [END metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js new file mode 100644 index 00000000000..863a6663f63 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastore_GetService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetService() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getService(request); + console.log(response); + } + + callGetService(); + // [END metastore_v1alpha_generated_DataprocMetastore_GetService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js new file mode 100644 index 00000000000..c78b7a873ce --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js @@ -0,0 +1,91 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1alpha_generated_DataprocMetastore_ListBackups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END metastore_v1alpha_generated_DataprocMetastore_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js new file mode 100644 index 00000000000..5f22941d095 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js @@ -0,0 +1,91 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListMetadataImports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listMetadataImportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMetadataImports(); + // [END metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js new file mode 100644 index 00000000000..904a272387f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1alpha_generated_DataprocMetastore_ListServices_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListServices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END metastore_v1alpha_generated_DataprocMetastore_ListServices_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js new file mode 100644 index 00000000000..5efc4842573 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js @@ -0,0 +1,88 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(service, backup) { + // [START metastore_v1alpha_generated_DataprocMetastore_RestoreService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const backup = 'abc123' + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + */ + // const restoreType = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRestoreService() { + // Construct request + const request = { + service, + backup, + }; + + // Run request + const [operation] = await metastoreClient.restoreService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreService(); + // [END metastore_v1alpha_generated_DataprocMetastore_RestoreService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js new file mode 100644 index 00000000000..ebaafa5b56c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, metadataImport) { + // [START metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateMetadataImport() { + // Construct request + const request = { + updateMask, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.updateMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMetadataImport(); + // [END metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js new file mode 100644 index 00000000000..f5ff29edf8a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, service) { + // [START metastore_v1alpha_generated_DataprocMetastore_UpdateService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateService() { + // Construct request + const request = { + updateMask, + service, + }; + + // Run request + const [operation] = await metastoreClient.updateService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateService(); + // [END metastore_v1alpha_generated_DataprocMetastore_UpdateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js new file mode 100644 index 00000000000..cbb67ce1733 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, federationId, federation) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location in which to create a federation + * service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const federationId = 'abc123' + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callCreateFederation() { + // Construct request + const request = { + parent, + federationId, + federation, + }; + + // Run request + const [operation] = await metastoreClient.createFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js new file mode 100644 index 00000000000..dae3bcd39ab --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callDeleteFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js new file mode 100644 index 00000000000..2d6a21c6e5a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore federation to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callGetFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getFederation(request); + console.log(response); + } + + callGetFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js new file mode 100644 index 00000000000..315f72aa06d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callListFederations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listFederationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFederations(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js new file mode 100644 index 00000000000..215f126c0f4 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, federation) { + // [START metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callUpdateFederation() { + // Construct request + const request = { + updateMask, + federation, + }; + + // Run request + const [operation] = await metastoreClient.updateFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFederation(); + // [END metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json new file mode 100644 index 00000000000..5c58d24311f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json @@ -0,0 +1,987 @@ +{ + "clientLibrary": { + "name": "nodejs-metastore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.metastore.v1alpha", + "version": "v1alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListServices_async", + "title": "DataprocMetastore listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists services in a project and location.", + "canonical": true, + "file": "dataproc_metastore.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListServicesResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetService_async", + "title": "DataprocMetastore getService Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single service.", + "canonical": true, + "file": "dataproc_metastore.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.Service", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateService_async", + "title": "DataprocMetastore createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore service in a project and location.", + "canonical": true, + "file": "dataproc_metastore.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_id", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1alpha.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateService_async", + "title": "DataprocMetastore updateService Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single service.", + "canonical": true, + "file": "dataproc_metastore.update_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1alpha.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteService_async", + "title": "DataprocMetastore deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single service.", + "canonical": true, + "file": "dataproc_metastore.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async", + "title": "DataprocMetastore listMetadataImports Sample", + "origin": "API_DEFINITION", + "description": " Lists imports in a service.", + "canonical": true, + "file": "dataproc_metastore.list_metadata_imports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListMetadataImportsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async", + "title": "DataprocMetastore getMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single import.", + "canonical": true, + "file": "dataproc_metastore.get_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.MetadataImport", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async", + "title": "DataprocMetastore createMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Creates a new MetadataImport in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import_id", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1alpha.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async", + "title": "DataprocMetastore updateMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", + "canonical": true, + "file": "dataproc_metastore.update_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1alpha.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async", + "title": "DataprocMetastore exportMetadata Sample", + "origin": "API_DEFINITION", + "description": " Exports metadata from a service.", + "canonical": true, + "file": "dataproc_metastore.export_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", + "async": true, + "parameters": [ + { + "name": "destination_gcs_folder", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "database_dump_type", + "type": ".google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_RestoreService_async", + "title": "DataprocMetastore restoreService Sample", + "origin": "API_DEFINITION", + "description": " Restores a service from a backup.", + "canonical": true, + "file": "dataproc_metastore.restore_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + }, + { + "name": "restore_type", + "type": ".google.cloud.metastore.v1alpha.Restore.RestoreType" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListBackups_async", + "title": "DataprocMetastore listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists backups in a service.", + "canonical": true, + "file": "dataproc_metastore.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListBackupsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetBackup_async", + "title": "DataprocMetastore getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single backup.", + "canonical": true, + "file": "dataproc_metastore.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.Backup", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async", + "title": "DataprocMetastore createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.metastore.v1alpha.Backup" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async", + "title": "DataprocMetastore deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single backup.", + "canonical": true, + "file": "dataproc_metastore.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async", + "title": "DataprocMetastore listFederations Sample", + "origin": "API_DEFINITION", + "description": " Lists federations in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.list_federations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.ListFederationsResponse", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async", + "title": "DataprocMetastore getFederation Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.get_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1alpha.Federation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async", + "title": "DataprocMetastore createFederation Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore federation in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.create_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "federation_id", + "type": "TYPE_STRING" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1alpha.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async", + "title": "DataprocMetastore updateFederation Sample", + "origin": "API_DEFINITION", + "description": " Updates the fields of a federation.", + "canonical": true, + "file": "dataproc_metastore_federation.update_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1alpha.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async", + "title": "DataprocMetastore deleteFederation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.delete_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts new file mode 100644 index 00000000000..cc79e394c0b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1alpha from './v1alpha'; +const DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; +type DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; +const DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; +type DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; +export {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +export default {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts new file mode 100644 index 00000000000..34fe31f390a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts @@ -0,0 +1,3173 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha/dataproc_metastore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore services. + * Metastore services are fully managed, highly available, autoscaled, + * autohealing, OSS-native deployments of technical metadata management + * software. Each metastore service exposes a network endpoint through which + * metadata queries are served. Metadata queries can originate from a variety + * of sources, including Apache Hive, Apache Presto, and Apache Spark. + * + * The Dataproc Metastore API defines the following resource model: + * + * * The service works with a collection of Google Cloud projects, named: + * `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * (a location must refer to a Google Cloud `region`) + * * Each location has a collection of services, named: `/services/*` + * * Dataproc Metastore services are resources with names of the form: + * + * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @class + * @memberof v1alpha + */ +export class DataprocMetastoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataprocMetastoreClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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 if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + lakePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/lakes/{lake}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listMetadataImports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; + const createServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; + const updateServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteServiceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const createMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; + const createMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; + const updateMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const exportMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.MetadataExport') as gax.protobuf.Type; + const exportMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const restoreServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Restore') as gax.protobuf.Type; + const restoreServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServiceResponse.decode.bind(createServiceResponse), + createServiceMetadata.decode.bind(createServiceMetadata)), + updateService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServiceResponse.decode.bind(updateServiceResponse), + updateServiceMetadata.decode.bind(updateServiceMetadata)), + deleteService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServiceResponse.decode.bind(deleteServiceResponse), + deleteServiceMetadata.decode.bind(deleteServiceMetadata)), + createMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMetadataImportResponse.decode.bind(createMetadataImportResponse), + createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), + updateMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), + updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), + exportMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportMetadataResponse.decode.bind(exportMetadataResponse), + exportMetadataMetadata.decode.bind(exportMetadataMetadata)), + restoreService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreServiceResponse.decode.bind(restoreServiceResponse), + restoreServiceMetadata.decode.bind(restoreServiceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1alpha.DataprocMetastore', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataprocMetastoreStub) { + return this.dataprocMetastoreStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1alpha.DataprocMetastore. + this.dataprocMetastoreStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastore') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastore, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataprocMetastoreStubMethods = + ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup']; + for (const methodName of dataprocMetastoreStubMethods) { + const callPromise = this.dataprocMetastoreStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'metastore.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets the details of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Service]{@link google.cloud.metastore.v1alpha.Service}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.get_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetService_async + */ + getService( + request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined + ]>; + getService( + request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService, + protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } +/** + * Gets details of a single import. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async + */ + getMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|undefined, {}|undefined + ]>; + getMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport, + protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getMetadataImport(request, options, callback); + } +/** + * Gets details of a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.cloud.metastore.v1alpha.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.get_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup, + protos.google.cloud.metastore.v1alpha.IGetBackupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBackup(request, options, callback); + } + +/** + * Creates a metastore service in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.serviceId + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1alpha.Service} request.service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async + */ + createService( + request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createService( + request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async + */ + async checkCreateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1alpha.Service} request.service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async + */ + updateService( + request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateService( + request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async + */ + async checkUpdateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async + */ + deleteService( + request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteService( + request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async + */ + async checkDeleteServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new MetadataImport in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.metadataImportId + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async + */ + createMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMetadataImport( + request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async + */ + async checkCreateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async + */ + updateMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metadata_import.name': request.metadataImport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async + */ + async checkUpdateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports metadata from a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type} [request.databaseDumpType] + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async + */ + exportMetadata( + request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportMetadata( + request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async + */ + async checkExportMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a service from a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {google.cloud.metastore.v1alpha.Restore.RestoreType} [request.restoreType] + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async + */ + restoreService( + request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreService( + request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async + */ + async checkRestoreServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new backup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backupId + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1alpha.Backup} request.backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists services in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.metastore.v1alpha.Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServices( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService[], + protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, + protos.google.cloud.metastore.v1alpha.IListServicesResponse + ]>; + listServices( + request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>): void; + listServices( + request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>): void; + listServices( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListServicesRequest, + protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IService>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IService[], + protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, + protos.google.cloud.metastore.v1alpha.IListServicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.cloud.metastore.v1alpha.Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServicesStream( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Service]{@link google.cloud.metastore.v1alpha.Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.list_services.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListServices_async + */ + listServicesAsync( + request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists imports in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetadataImports( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport[], + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse + ]>; + listMetadataImports( + request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; + listMetadataImports( + request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; + listMetadataImports( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IMetadataImport>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IMetadataImport[], + protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listMetadataImports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetadataImportsStream( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.createStream( + this.innerApiCalls.listMetadataImports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMetadataImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async + */ + listMetadataImportsAsync( + request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.asyncIterate( + this.innerApiCalls['listMetadataImports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists backups in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Backup]{@link google.cloud.metastore.v1alpha.Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup[], + protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>): void; + listBackups( + request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>): void; + listBackups( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IBackup>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IBackup[], + protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, + protos.google.cloud.metastore.v1alpha.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Backup]{@link google.cloud.metastore.v1alpha.Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.cloud.metastore.v1alpha.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore.list_backups.js + * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified lake resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} lake + * @returns {string} Resource name string. + */ + lakePath(project:string,location:string,lake:string) { + return this.pathTemplates.lakePathTemplate.render({ + project: project, + location: location, + lake: lake, + }); + } + + /** + * Parse the project from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).project; + } + + /** + * Parse the location from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).location; + } + + /** + * Parse the lake from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the lake. + */ + matchLakeFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).lake; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataprocMetastoreStub && !this._terminated) { + return this.dataprocMetastoreStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json new file mode 100644 index 00000000000..7e022b9adaf --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json @@ -0,0 +1,113 @@ +{ + "interfaces": { + "google.cloud.metastore.v1alpha.DataprocMetastore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts new file mode 100644 index 00000000000..3677ca95b19 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts @@ -0,0 +1,1725 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha/dataproc_metastore_federation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore federation services. + * Dataproc Metastore Federation Service allows federating a collection of + * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc + * Metastores. The Federation Service exposes a gRPC URL through which metadata + * from the backend metastores are served at query time. + * + * The Dataproc Metastore Federation API defines the following resource model: + * * The service works with a collection of Google Cloud projects. + * * Each project has a collection of available locations. + * * Each location has a collection of federations. + * * Dataproc Metastore Federations are resources with names of the + * form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @class + * @memberof v1alpha + */ +export class DataprocMetastoreFederationClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreFederationClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataprocMetastoreFederationClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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 if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listFederations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; + const createFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const updateFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; + const updateFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + const deleteFederationResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFederationResponse.decode.bind(createFederationResponse), + createFederationMetadata.decode.bind(createFederationMetadata)), + updateFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFederationResponse.decode.bind(updateFederationResponse), + updateFederationMetadata.decode.bind(updateFederationMetadata)), + deleteFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFederationResponse.decode.bind(deleteFederationResponse), + deleteFederationMetadata.decode.bind(deleteFederationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataprocMetastoreFederationStub) { + return this.dataprocMetastoreFederationStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1alpha.DataprocMetastoreFederation. + this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastoreFederation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastoreFederation, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataprocMetastoreFederationStubMethods = + ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; + for (const methodName of dataprocMetastoreFederationStubMethods) { + const callPromise = this.dataprocMetastoreFederationStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreFederationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'metastore.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets the details of a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Federation]{@link google.cloud.metastore.v1alpha.Federation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async + */ + getFederation( + request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|undefined, {}|undefined + ]>; + getFederation( + request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + callback: Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation, + protos.google.cloud.metastore.v1alpha.IGetFederationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFederation(request, options, callback); + } + +/** + * Creates a metastore federation in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a federation + * service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.federationId + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1alpha.Federation} request.federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async + */ + createFederation( + request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFederation( + request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async + */ + async checkCreateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the fields of a federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1alpha.Federation} request.federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + updateFederation( + request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFederation( + request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'federation.name': request.federation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + async checkUpdateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + deleteFederation( + request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFederation( + request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + async checkDeleteFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists federations in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Federation]{@link google.cloud.metastore.v1alpha.Federation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFederations( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation[], + protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse + ]>; + listFederations( + request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>): void; + listFederations( + request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>): void; + listFederations( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1alpha.IFederation>): + Promise<[ + protos.google.cloud.metastore.v1alpha.IFederation[], + protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, + protos.google.cloud.metastore.v1alpha.IListFederationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFederations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Federation]{@link google.cloud.metastore.v1alpha.Federation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFederationsStream( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.createStream( + this.innerApiCalls.listFederations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFederations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Federation]{@link google.cloud.metastore.v1alpha.Federation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js + * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async + */ + listFederationsAsync( + request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.asyncIterate( + this.innerApiCalls['listFederations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataprocMetastoreFederationStub && !this._terminated) { + return this.dataprocMetastoreFederationStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json new file mode 100644 index 00000000000..f764c70b10a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.metastore.v1alpha.DataprocMetastoreFederation": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListFederations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json new file mode 100644 index 00000000000..5aa3fc8ef92 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1alpha/metastore.proto", + "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json new file mode 100644 index 00000000000..5aa3fc8ef92 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1alpha/metastore.proto", + "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json new file mode 100644 index 00000000000..ecfbf2278fa --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json @@ -0,0 +1,253 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.metastore.v1alpha", + "libraryPackage": "@google-cloud/dataproc-metastore", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts new file mode 100644 index 00000000000..3e1ee876b29 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {DataprocMetastoreClient} from './dataproc_metastore_client'; +export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..74e7a6657af --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const metastore = require('@google-cloud/dataproc-metastore'); + +function main() { + const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); + const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..f10cef1cd2c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; + +// check that the client class type name can be used +function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { + client.close(); +} +function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dataprocMetastoreClient = new DataprocMetastoreClient(); + doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); + // check that the client instance can be created + const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts new file mode 100644 index 00000000000..2c9ccd3dfda --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts @@ -0,0 +1,2000 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as dataprocmetastorefederationModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha.DataprocMetastoreFederationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreFederationStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreFederationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getFederation', () => { + it('invokes getFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); + const [response] = await client.getFederation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFederation( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with closed client', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFederation(request), expectedError); + }); + }); + + describe('createFederation', () => { + it('invokes createFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFederation', () => { + it('invokes updateFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFederation', () => { + it('invokes deleteFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFederations', () => { + it('invokes listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); + const [response] = await client.listFederations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFederations( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFederations(request), expectedError); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederationsStream without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFederationsStream with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), + ]; + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; + const iterable = client.listFederationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFederationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts new file mode 100644 index 00000000000..4d6772b3e72 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts @@ -0,0 +1,3718 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as dataprocmetastoreModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha.DataprocMetastoreClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getService', () => { + it('invokes getService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Service() + ); + client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('getMetadataImport', () => { + it('invokes getMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); + const [response] = await client.getMetadataImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetadataImport( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetadataImport(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); + const [operation] = await client.createService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createMetadataImport', () => { + it('invokes createMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMetadataImport', () => { + it('invokes updateMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportMetadata', () => { + it('invokes exportMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreService', () => { + it('invokes restoreService without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreService(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMetadataImports', () => { + it('invokes listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); + const [response] = await client.listMetadataImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetadataImports( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMetadataImports(request), expectedError); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImportsStream without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMetadataImportsStream with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; + const iterable = client.listMetadataImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetadataImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('lake', () => { + const fakePath = "/rendered/path/lake"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + lake: "lakeValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.lakePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.lakePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('lakePath', () => { + const result = client.lakePath("projectValue", "locationValue", "lakeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.lakePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLakeName', () => { + const result = client.matchProjectFromLakeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLakeName', () => { + const result = client.matchLocationFromLakeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLakeFromLakeName', () => { + const result = client.matchLakeFromLakeName(fakePath); + assert.strictEqual(result, "lakeValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js new file mode 100644 index 00000000000..6fc45cb3d30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'DataprocMetastore', + filename: './dataproc-metastore.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore b/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js new file mode 100644 index 00000000000..bc8b6fc164f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dataproc-metastore', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/README.md b/owl-bot-staging/google-cloud-metastore/v1beta/README.md new file mode 100644 index 00000000000..24afb9017c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/README.md @@ -0,0 +1 @@ +Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json b/owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/package.json b/owl-bot-staging/google-cloud-metastore/v1beta/package.json new file mode 100644 index 00000000000..b3e0a6424ad --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/dataproc-metastore", + "version": "0.1.0", + "description": "Metastore client for Node.js", + "repository": "googleapis/nodejs-metastore", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google metastore", + "metastore", + "dataproc metastore", + "dataproc metastore federation" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto new file mode 100644 index 00000000000..6259c124165 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto @@ -0,0 +1,1462 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.metastore.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/dayofweek.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta;metastore"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreProto"; +option java_package = "com.google.cloud.metastore.v1beta"; +option php_namespace = "Google\\Cloud\\Metastore\\V1beta"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Subnetwork" + pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" +}; +option (google.api.resource_definition) = { + type: "dataplex.googleapis.com/Lake" + pattern: "projects/{project}/locations/{location}/lakes/{lake}" +}; + +// Configures and manages metastore services. +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management +// software. Each metastore service exposes a network endpoint through which +// metadata queries are served. Metadata queries can originate from a variety +// of sources, including Apache Hive, Apache Presto, and Apache Spark. +// +// The Dataproc Metastore API defines the following resource model: +// +// * The service works with a collection of Google Cloud projects, named: +// `/projects/*` +// * Each project has a collection of available locations, named: `/locations/*` +// (a location must refer to a Google Cloud `region`) +// * Each location has a collection of services, named: `/services/*` +// * Dataproc Metastore services are resources with names of the form: +// +// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. +service DataprocMetastore { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists services in a project and location. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore service in a project and location. + rpc CreateService(CreateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Updates the parameters of a single service. + rpc UpdateService(UpdateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{service.name=projects/*/locations/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Service" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Deletes a single service. + rpc DeleteService(DeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/services/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Lists imports in a service. + rpc ListMetadataImports(ListMetadataImportsRequest) + returns (ListMetadataImportsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single import. + rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*/metadataImports/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new MetadataImport in a given project and location. + rpc CreateMetadataImport(CreateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" + body: "metadata_import" + }; + option (google.api.method_signature) = + "parent,metadata_import,metadata_import_id"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Updates a single import. + // Only the description field of MetadataImport is supported to be updated. + rpc UpdateMetadataImport(UpdateMetadataImportRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" + body: "metadata_import" + }; + option (google.api.method_signature) = "metadata_import,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "MetadataImport" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Exports metadata from a service. + rpc ExportMetadata(ExportMetadataRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:exportMetadata" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "MetadataExport" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Restores a service from a backup. + rpc RestoreService(RestoreServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{service=projects/*/locations/*/services/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "service,backup"; + option (google.longrunning.operation_info) = { + response_type: "Restore" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Lists backups in a service. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new backup in a given project and location. + rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent,backup,backup_id"; + option (google.longrunning.operation_info) = { + response_type: "Backup" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Deletes a single backup. + rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } +} + +// A managed metastore service that serves metadata queries. +message Service { + option (google.api.resource) = { + type: "metastore.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + }; + + // The current state of the metastore service. + enum State { + // The state of the metastore service is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore service is in the process of being created. + CREATING = 1; + + // The metastore service is running and ready to serve queries. + ACTIVE = 2; + + // The metastore service is entering suspension. Its query-serving + // availability may cease unexpectedly. + SUSPENDING = 3; + + // The metastore service is suspended and unable to serve queries. + SUSPENDED = 4; + + // The metastore service is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 5; + + // The metastore service is undergoing deletion. It cannot be used. + DELETING = 6; + + // The metastore service has encountered an error and cannot be used. The + // metastore service should be deleted. + ERROR = 7; + } + + // Available service tiers. + enum Tier { + // The tier is not set. + TIER_UNSPECIFIED = 0; + + // The developer tier provides limited scalability and no fault tolerance. + // Good for low-cost proof-of-concept. + DEVELOPER = 1; + + // The enterprise tier provides multi-zone high availability, and sufficient + // scalability for enterprise-level Dataproc Metastore workloads. + ENTERPRISE = 3; + } + + // Release channels bundle features of varying levels of stability. Newer + // features may be introduced initially into less stable release channels and + // can be automatically promoted into more stable release channels. + enum ReleaseChannel { + // Release channel is not specified. + RELEASE_CHANNEL_UNSPECIFIED = 0; + + // The `CANARY` release channel contains the newest features, which may be + // unstable and subject to unresolved issues with no known workarounds. + // Services using the `CANARY` release channel are not subject to any SLAs. + CANARY = 1; + + // The `STABLE` release channel contains features that are considered stable + // and have been validated for production use. + STABLE = 2; + } + + // The backend database type for the metastore service. + enum DatabaseType { + // The DATABASE_TYPE is not set. + DATABASE_TYPE_UNSPECIFIED = 0; + + // MySQL is used to persist the metastore data. + MYSQL = 1; + + // Spanner is used to persist the metastore data. + SPANNER = 2; + } + + // Configuration properties specific to the underlying metastore service + // technology (the software that serves metastore queries). + oneof metastore_config { + // Configuration information specific to running Hive metastore + // software as the metastore service. + HiveMetastoreConfig hive_metastore_config = 5; + } + + // Immutable. The relative resource name of the metastore service, in the + // following format: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore service was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore service was last updated. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore service. + map labels = 4; + + // Immutable. The relative resource name of the VPC network on which the + // instance can be accessed. It is specified in the following form: + // + // `projects/{project_number}/global/networks/{network_id}`. + string network = 7 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; + + // Output only. The URI of the endpoint used to access the metastore service. + string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The TCP port at which the metastore service is reached. Default: 9083. + int32 port = 9; + + // Output only. The current state of the metastore service. + State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the + // metastore service, if available. + string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A Cloud Storage URI (starting with `gs://`) that specifies + // where artifacts related to the metastore service are stored. + string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The tier of the service. + Tier tier = 13; + + // The setting that defines how metastore metadata should be integrated with + // external services and systems. + MetadataIntegration metadata_integration = 14; + + // The one hour maintenance window of the metastore service. This specifies + // when the service can be restarted for maintenance purposes in UTC time. + // Maintenance window is not needed for services with the SPANNER + // database type. + MaintenanceWindow maintenance_window = 15; + + // Output only. The globally unique resource identifier of the metastore + // service. + string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The metadata management activities of the metastore service. + MetadataManagementActivity metadata_management_activity = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The release channel of the service. + // If unspecified, defaults to `STABLE`. + ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. Information used to configure the Dataproc Metastore service to + // encrypt customer data at rest. Cannot be updated. + EncryptionConfig encryption_config = 20 + [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying the network settings for the + // Dataproc Metastore service. + NetworkConfig network_config = 21; + + // Immutable. The database type that the Metastore service stores its data. + DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; + + // The configuration specifying telemetry settings for the Dataproc Metastore + // service. If unspecified defaults to `JSON`. + TelemetryConfig telemetry_config = 23; +} + +// Specifies how metastore metadata should be integrated with external services. +message MetadataIntegration { + // The integration config for the Data Catalog service. + DataCatalogConfig data_catalog_config = 1; + + // The integration config for the Dataplex service. + DataplexConfig dataplex_config = 2; +} + +// Specifies how metastore metadata should be integrated with the Data Catalog +// service. +message DataCatalogConfig { + // Defines whether the metastore metadata should be synced to Data Catalog. + // The default value is to disable syncing metastore metadata to Data Catalog. + bool enabled = 2; +} + +// Specifies how metastore metadata should be integrated with the Dataplex +// service. +message DataplexConfig { + // A reference to the Lake resources that this metastore service is attached + // to. The key is the lake resource name. Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. + map lake_resources = 1; +} + +// Represents a Lake resource +message Lake { + // The Lake resource name. + // Example: + // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` + string name = 1 [ + (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } + ]; +} + +// Maintenance window. This specifies when Dataproc Metastore +// may perform system maintenance operation to the service. +message MaintenanceWindow { + // The hour of day (0-23) when the window starts. + google.protobuf.Int32Value hour_of_day = 1; + + // The day of week, when the window starts. + google.type.DayOfWeek day_of_week = 2; +} + +// Specifies configuration information specific to running Hive metastore +// software as the metastore service. +message HiveMetastoreConfig { + // Protocols available for serving the metastore service endpoint. + enum EndpointProtocol { + // The protocol is not set. + ENDPOINT_PROTOCOL_UNSPECIFIED = 0; + + // Use the legacy Apache Thrift protocol for the metastore service endpoint. + THRIFT = 1; + + // Use the modernized gRPC protocol for the metastore service endpoint. + GRPC = 2; + } + + // Immutable. The Hive metastore schema version. + string version = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // Hive metastore (configured in `hive-site.xml`). The mappings + // override system defaults (some keys cannot be overridden). These + // overrides are also applied to auxiliary versions and can be further + // customized in the auxiliary version's `AuxiliaryVersionConfig`. + map config_overrides = 2; + + // Information used to configure the Hive metastore service as a service + // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` + // method and specify this field's path + // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` + // while omitting this field from the request's `service`. + KerberosConfig kerberos_config = 3; + + // The protocol to use for the metastore service endpoint. If unspecified, + // defaults to `THRIFT`. + EndpointProtocol endpoint_protocol = 4; + + // A mapping of Hive metastore version to the auxiliary version + // configuration. When specified, a secondary Hive metastore service is + // created along with the primary service. All auxiliary versions must be less + // than the service's primary version. The key is the auxiliary service name + // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This + // means that the first character must be a lowercase letter, and all the + // following characters must be hyphens, lowercase letters, or digits, except + // the last character, which cannot be a hyphen. + map auxiliary_versions = 5; +} + +// Configuration information for a Kerberos principal. +message KerberosConfig { + // A Kerberos keytab file that can be used to authenticate a service principal + // with a Kerberos Key Distribution Center (KDC). + Secret keytab = 1; + + // A Kerberos principal that exists in the both the keytab the KDC + // to authenticate as. A typical principal is of the form + // `primary/instance@REALM`, but there is no exact format. + string principal = 2; + + // A Cloud Storage URI that specifies the path to a + // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, + // although the file does not need to be named krb5.conf explicitly. + string krb5_config_gcs_uri = 3; +} + +// A securely stored value. +message Secret { + oneof value { + // The relative resource name of a Secret Manager secret version, in the + // following form: + // + // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. + string cloud_secret = 2; + } +} + +// Encryption settings for the service. +message EncryptionConfig { + // The fully qualified customer provided Cloud KMS key name to use for + // customer data encryption, in the following form: + // + // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. + string kms_key = 1; +} + +// Configuration information for the auxiliary service versions. +message AuxiliaryVersionConfig { + // The Hive metastore version of the auxiliary service. It must be less + // than the primary Hive metastore service's version. + string version = 1; + + // A mapping of Hive metastore configuration key-value pairs to apply to the + // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to + // the primary version's overrides. If keys are present in both the auxiliary + // version's overrides and the primary version's overrides, the value from + // the auxiliary version's overrides takes precedence. + map config_overrides = 2; + + // Output only. The network configuration contains the endpoint URI(s) of the + // auxiliary Hive metastore service. + NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Network configuration for the Dataproc Metastore service. +message NetworkConfig { + // Contains information of the customer's network configurations. + message Consumer { + oneof vpc_resource { + // Immutable. The subnetwork of the customer project from which an IP + // address is reserved and used as the Dataproc Metastore service's + // endpoint. It is accessible to hosts in the subnet and to all + // hosts in a subnet in the same region and same network. There must + // be at least one IP address available in the subnet's primary range. The + // subnet is specified in the following form: + // + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` + string subnetwork = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Subnetwork" + } + ]; + } + + // Output only. The URI of the endpoint used to access the metastore + // service. + string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Immutable. The consumer-side network configuration for the Dataproc + // Metastore instance. + repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; +} + +// Telemetry Configuration for the Dataproc Metastore service. +message TelemetryConfig { + enum LogFormat { + // The LOG_FORMAT is not set. + LOG_FORMAT_UNSPECIFIED = 0; + + // Logging output uses the legacy `textPayload` format. + LEGACY = 1; + + // Logging output uses the `jsonPayload` format. + JSON = 2; + } + + // The output format of the Dataproc Metastore service's logs. + LogFormat log_format = 1; +} + +// The metadata management activities of the metastore service. +message MetadataManagementActivity { + // Output only. The latest metadata exports of the metastore service. + repeated MetadataExport metadata_exports = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The latest restores of the metastore service. + repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A metastore resource that imports metadata. +message MetadataImport { + option (google.api.resource) = { + type: "metastore.googleapis.com/MetadataImport" + pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" + }; + + // A specification of the location of and metadata about a database dump from + // a relational database management system. + message DatabaseDump { + // The type of the database. + enum DatabaseType { + // The type of the source database is unknown. + DATABASE_TYPE_UNSPECIFIED = 0; + + // The type of the source database is MySQL. + MYSQL = 1; + } + + // The type of the database. + DatabaseType database_type = 1 [deprecated = true]; + + // A Cloud Storage object or folder URI that specifies the source from which + // to import metadata. It must begin with `gs://`. + string gcs_uri = 2; + + // The name of the source database. + string source_database = 3 [deprecated = true]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The current state of the metadata import. + enum State { + // The state of the metadata import is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata import is running. + RUNNING = 1; + + // The metadata import completed successfully. + SUCCEEDED = 2; + + // The metadata import is being updated. + UPDATING = 3; + + // The metadata import failed, and attempted metadata changes were rolled + // back. + FAILED = 4; + } + + // The metadata to be imported. + oneof metadata { + // Immutable. A database dump from a pre-existing metastore's database. + DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; + } + + // Immutable. The relative resource name of the metadata import, of the form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The description of the metadata import. + string description = 2; + + // Output only. The time when the metadata import was started. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metadata import finished. + google.protobuf.Timestamp end_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the metadata import. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata export operation. +message MetadataExport { + // The current state of the metadata export. + enum State { + // The state of the metadata export is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata export is running. + RUNNING = 1; + + // The metadata export completed successfully. + SUCCEEDED = 2; + + // The metadata export failed. + FAILED = 3; + + // The metadata export is cancelled. + CANCELLED = 4; + } + + oneof destination { + // Output only. A Cloud Storage URI of a folder that metadata are exported + // to, in the form of + // `gs:////`, where + // `` is automatically generated. + string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The time when the export started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the export ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the export. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the database dump. + DatabaseDumpSpec.Type database_dump_type = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a backup resource. +message Backup { + option (google.api.resource) = { + type: "metastore.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" + }; + + // The current state of the backup. + enum State { + // The state of the backup is unknown. + STATE_UNSPECIFIED = 0; + + // The backup is being created. + CREATING = 1; + + // The backup is being deleted. + DELETING = 2; + + // The backup is active and ready to use. + ACTIVE = 3; + + // The backup failed. + FAILED = 4; + + // The backup is being restored. + RESTORING = 5; + } + + // Immutable. The relative resource name of the backup, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the backup was started. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the backup finished creating. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the backup. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The revision of the service at the time of backup. + Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the backup. + string description = 6; + + // Output only. Services that are restoring from the backup. + repeated string restoring_services = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The details of a metadata restore operation. +message Restore { + // The current state of the restore. + enum State { + // The state of the metadata restore is unknown. + STATE_UNSPECIFIED = 0; + + // The metadata restore is running. + RUNNING = 1; + + // The metadata restore completed successfully. + SUCCEEDED = 2; + + // The metadata restore failed. + FAILED = 3; + + // The metadata restore is cancelled. + CANCELLED = 4; + } + + // The type of restore. If unspecified, defaults to `METADATA_ONLY`. + enum RestoreType { + // The restore type is unknown. + RESTORE_TYPE_UNSPECIFIED = 0; + + // The service's metadata and configuration are restored. + FULL = 1; + + // Only the service's metadata is restored. + METADATA_ONLY = 2; + } + + // Output only. The time when the restore started. + google.protobuf.Timestamp start_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the restore ended. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the restore. + State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Output only. The type of restore. + RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The restore details containing the revision of the service to + // be restored to, in format of JSON. + string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. +message ListServicesRequest { + // Required. The relative resource name of the location of metastore services + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of services to return. The response may + // contain less than the maximum number. If unspecified, no more than 500 + // services are returned. The maximum value is 1000; values above 1000 are + // changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. +message ListServicesResponse { + // The services in the specified location. + repeated Service services = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetService][google.cloud.metastore.v1beta.DataprocMetastore.GetService]. +message GetServiceRequest { + // Required. The relative resource name of the metastore service to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateService][google.cloud.metastore.v1beta.DataprocMetastore.CreateService]. +message CreateServiceRequest { + // Required. The relative resource name of the location in which to create a + // metastore service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The ID of the metastore service, which is used as the final + // component of the metastore service's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore service to create. The `name` field is + // ignored. The ID of the created metastore service must be provided in + // the request's `service_id` field. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateService][google.cloud.metastore.v1beta.DataprocMetastore.UpdateService]. +message UpdateServiceRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore service resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore service to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore service's `name` field is used to identify the metastore + // service to be updated. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteService][google.cloud.metastore.v1beta.DataprocMetastore.DeleteService]. +message DeleteServiceRequest { + // Required. The relative resource name of the metastore service to delete, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsRequest { + // Required. The relative resource name of the service whose metadata imports + // to list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Optional. The maximum number of imports to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 imports are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. +message ListMetadataImportsResponse { + // The imports in the specified service. + repeated MetadataImport metadata_imports = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport]. +message GetMetadataImportRequest { + // Required. The relative resource name of the metadata import to retrieve, in + // the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/MetadataImport" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport]. +message CreateMetadataImportRequest { + // Required. The relative resource name of the service in which to create a + // metastore import, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/MetadataImport" + } + ]; + + // Required. The ID of the metadata import, which is used as the final + // component of the metadata import's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to create. The `name` field is ignored. The + // ID of the created metadata import must be provided in the request's + // `metadata_import_id` field. + MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport]. +message UpdateMetadataImportRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metadata import resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The metadata import to update. The server only merges fields + // in the import if they are specified in `update_mask`. + // + // The metadata import's `name` field is used to identify the metastore + // import to be updated. + MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. +message ListBackupsRequest { + // Required. The relative resource name of the service whose backups to + // list, in the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The maximum number of backups to return. The response may contain + // less than the maximum number. If unspecified, no more than 500 backups are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] + // must match the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. +message ListBackupsResponse { + // The backups of the specified service. + repeated Backup backups = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for +// [DataprocMetastore.GetBackup][google.cloud.metastore.v1beta.DataprocMetastore.GetBackup]. +message GetBackupRequest { + // Required. The relative resource name of the backup to retrieve, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; +} + +// Request message for +// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup]. +message CreateBackupRequest { + // Required. The relative resource name of the service in which to create a + // backup of the following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Backup" + } + ]; + + // Required. The ID of the backup, which is used as the final component of the + // backup's name. + // + // This value must be between 1 and 64 characters long, begin with a letter, + // end with a letter or number, and consist of alpha-numeric ASCII characters + // or hyphens. + string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The backup to create. The `name` field is ignored. The ID of the + // created backup must be provided in the request's `backup_id` field. + Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup]. +message DeleteBackupRequest { + // Required. The relative resource name of the backup to delete, in the + // following form: + // + // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata]. +message ExportMetadataRequest { + // Required. Destination that metadata is exported to. + oneof destination { + // A Cloud Storage URI of a folder, in the format + // `gs:///`. A sub-folder + // `` containing exported files will be created below it. + string destination_gcs_folder = 2; + } + + // Required. The relative resource name of the metastore service to run + // export, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The type of the database dump. If unspecified, defaults to + // `MYSQL`. + DatabaseDumpSpec.Type database_dump_type = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [DataprocMetastore.Restore][]. +message RestoreServiceRequest { + // Required. The relative resource name of the metastore service to run + // restore, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}`. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Service" + } + ]; + + // Required. The relative resource name of the metastore service backup to + // restore from, in the following form: + // + // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + string backup = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Backup" + } + ]; + + // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A request ID. Specify a unique request ID to allow the server to + // ignore the request if it has completed. The server will ignore subsequent + // requests that provide a duplicate request ID for at least 60 minutes after + // the first request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of a long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the caller has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Metadata about the service in a location. +message LocationMetadata { + // A specification of a supported version of the Hive Metastore software. + message HiveMetastoreVersion { + // The semantic version of the Hive Metastore software. + string version = 1; + + // Whether `version` will be chosen by the server if a metastore service is + // created with a `HiveMetastoreConfig` that omits the `version`. + bool is_default = 2; + } + + // The versions of Hive Metastore that can be used when creating a new + // metastore service in this location. The server guarantees that exactly one + // `HiveMetastoreVersion` in the list will set `is_default`. + repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; +} + +// The specification of database dump to import from or export to. +message DatabaseDumpSpec { + // The type of the database dump. + enum Type { + // The type of the database dump is unknown. + TYPE_UNSPECIFIED = 0; + + // Database dump is a MySQL dump file. + MYSQL = 1; + + // Database dump contains Avro files. + AVRO = 2; + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto new file mode 100644 index 00000000000..c0798f7bada --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto @@ -0,0 +1,364 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.metastore.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta;metastore"; +option java_multiple_files = true; +option java_outer_classname = "MetastoreFederationProto"; +option java_package = "com.google.cloud.metastore.v1beta"; + +// Configures and manages metastore federation services. +// Dataproc Metastore Federation Service allows federating a collection of +// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc +// Metastores. The Federation Service exposes a gRPC URL through which metadata +// from the backend metastores are served at query time. +// +// The Dataproc Metastore Federation API defines the following resource model: +// * The service works with a collection of Google Cloud projects. +// * Each project has a collection of available locations. +// * Each location has a collection of federations. +// * Dataproc Metastore Federations are resources with names of the +// form: +// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. +service DataprocMetastoreFederation { + option (google.api.default_host) = "metastore.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists federations in a project and location. + rpc ListFederations(ListFederationsRequest) returns (ListFederationsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/federations" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the details of a single federation. + rpc GetFederation(GetFederationRequest) returns (Federation) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a metastore federation in a project and location. + rpc CreateFederation(CreateFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/federations" + body: "federation" + }; + option (google.api.method_signature) = "parent,federation,federation_id"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Updates the fields of a federation. + rpc UpdateFederation(UpdateFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1beta/{federation.name=projects/*/locations/*/federations/*}" + body: "federation" + }; + option (google.api.method_signature) = "federation,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Federation" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } + + // Deletes a single federation. + rpc DeleteFederation(DeleteFederationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/locations/*/federations/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" + }; + } +} + +// Represents a federation of multiple backend metastores. +message Federation { + option (google.api.resource) = { + type: "metastore.googleapis.com/Federation" + pattern: "projects/{project}/locations/{location}/federations/{federation}" + }; + + // The current state of the federation. + enum State { + // The state of the metastore federation is unknown. + STATE_UNSPECIFIED = 0; + + // The metastore federation is in the process of being created. + CREATING = 1; + + // The metastore federation is running and ready to serve queries. + ACTIVE = 2; + + // The metastore federation is being updated. It remains usable but cannot + // accept additional update requests or be deleted at this time. + UPDATING = 3; + + // The metastore federation is undergoing deletion. It cannot be used. + DELETING = 4; + + // The metastore federation has encountered an error and cannot be used. The + // metastore federation should be deleted. + ERROR = 5; + } + + // Immutable. The relative resource name of the federation, of the + // form: + // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time when the metastore federation was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the metastore federation was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User-defined labels for the metastore federation. + map labels = 4; + + // Immutable. The Apache Hive metastore version of the federation. All backend metastore + // versions must be compatible with the federation version. + string version = 5 [(google.api.field_behavior) = IMMUTABLE]; + + // A map from `BackendMetastore` rank to `BackendMetastore`s from which the + // federation service serves metadata at query time. The map key represents + // the order in which `BackendMetastore`s should be evaluated to resolve + // database names at query time and should be greater than or equal to zero. A + // `BackendMetastore` with a lower number will be evaluated before a + // `BackendMetastore` with a higher number. + map backend_metastores = 6; + + // Output only. The federation endpoint. + string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the federation. + State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Additional information about the current state of the metastore federation, + // if available. + string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The globally unique resource identifier of the metastore federation. + string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a backend metastore for the federation. +message BackendMetastore { + // The type of the backend metastore. + enum MetastoreType { + // The metastore type is not set. + METASTORE_TYPE_UNSPECIFIED = 0; + + // The backend metastore is BigQuery. + BIGQUERY = 2; + + // The backend metastore is Dataproc Metastore. + DATAPROC_METASTORE = 3; + } + + // The relative resource name of the metastore that is being federated. + // The formats of the relative resource names for the currently supported + // metastores are listed below: + // + // * Dataplex + // * `projects/{project_id}/locations/{location}/lakes/{lake_id}` + // * BigQuery + // * `projects/{project_id}` + // * Dataproc Metastore + // * `projects/{project_id}/locations/{location}/services/{service_id}` + string name = 1; + + // The type of the backend metastore. + MetastoreType metastore_type = 2; +} + +// Request message for ListFederations. +message ListFederationsRequest { + // Required. The relative resource name of the location of metastore federations + // to list, in the following form: + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. The maximum number of federations to return. The response may contain less + // than the maximum number. If unspecified, no more than 500 services are + // returned. The maximum value is 1000; values above 1000 are changed to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous ListFederationServices + // call. Provide this token to retrieve the subsequent page. + // + // To retrieve the first page, supply an empty page token. + // + // When paginating, other parameters provided to + // ListFederationServices must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to apply to list results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify the ordering of results as described in [Sorting + // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + // If not specified, the results will be sorted in the default order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListFederations +message ListFederationsResponse { + // The services in the specified location. + repeated Federation federations = 1; + + // A token that can be sent as `page_token` to retrieve the next page. If this + // field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for GetFederation. +message GetFederationRequest { + // Required. The relative resource name of the metastore federation to retrieve, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; +} + +// Request message for CreateFederation. +message CreateFederationRequest { + // Required. The relative resource name of the location in which to create a federation + // service, in the following form: + // + // `projects/{project_number}/locations/{location_id}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "metastore.googleapis.com/Federation" + } + ]; + + // Required. The ID of the metastore federation, which is used as the final + // component of the metastore federation's name. + // + // This value must be between 2 and 63 characters long inclusive, begin with a + // letter, end with a letter or number, and consist of alpha-numeric + // ASCII characters or hyphens. + string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Metastore Federation to create. The `name` field is + // ignored. The ID of the created metastore federation must be + // provided in the request's `federation_id` field. + Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UpdateFederation. +message UpdateFederationRequest { + // Required. A field mask used to specify the fields to be overwritten in the + // metastore federation resource by the update. + // Fields specified in the `update_mask` are relative to the resource (not + // to the full request). A field is overwritten if it is in the mask. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The metastore federation to update. The server only merges fields + // in the service if they are specified in `update_mask`. + // + // The metastore federation's `name` field is used to identify the + // metastore service to be updated. + Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteFederation. +message DeleteFederationRequest { + // Required. The relative resource name of the metastore federation to delete, + // in the following form: + // + // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "metastore.googleapis.com/Federation" + } + ]; + + // Optional. A request ID. Specify a unique request ID to allow the server to ignore the + // request if it has completed. The server will ignore subsequent requests + // that provide a duplicate request ID for at least 60 minutes after the first + // request. + // + // For example, if an initial request times out, followed by another request + // with the same request ID, the server ignores the second request to prevent + // the creation of duplicate commitments. + // + // The request ID must be a valid + // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js new file mode 100644 index 00000000000..f24171ffbd8 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backupId, backup) { + // [START metastore_v1beta_generated_DataprocMetastore_CreateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const backupId = 'abc123' + /** + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + */ + // const backup = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backupId, + backup, + }; + + // Run request + const [operation] = await metastoreClient.createBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateBackup(); + // [END metastore_v1beta_generated_DataprocMetastore_CreateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js new file mode 100644 index 00000000000..c08664914ff --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, metadataImportId, metadataImport) { + // [START metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + */ + // const metadataImportId = 'abc123' + /** + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateMetadataImport() { + // Construct request + const request = { + parent, + metadataImportId, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.createMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateMetadataImport(); + // [END metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js new file mode 100644 index 00000000000..5373570348d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, serviceId, service) { + // [START metastore_v1beta_generated_DataprocMetastore_CreateService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const serviceId = 'abc123' + /** + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callCreateService() { + // Construct request + const request = { + parent, + serviceId, + service, + }; + + // Run request + const [operation] = await metastoreClient.createService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateService(); + // [END metastore_v1beta_generated_DataprocMetastore_CreateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js new file mode 100644 index 00000000000..5b880b8fdb5 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the backup to delete, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteBackup(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteBackup(); + // [END metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js new file mode 100644 index 00000000000..2d768c7583b --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastore_DeleteService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callDeleteService() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteService(); + // [END metastore_v1beta_generated_DataprocMetastore_DeleteService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js new file mode 100644 index 00000000000..6ff2ada6aa4 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js @@ -0,0 +1,88 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(service) { + // [START metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + */ + // const destinationGcsFolder = 'abc123' + /** + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + /** + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + */ + // const databaseDumpType = {} + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callExportMetadata() { + // Construct request + const request = { + service, + }; + + // Run request + const [operation] = await metastoreClient.exportMetadata(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportMetadata(); + // [END metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js new file mode 100644 index 00000000000..93ebad0f55d --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastore_GetBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END metastore_v1beta_generated_DataprocMetastore_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js new file mode 100644 index 00000000000..8ff7acc3d96 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetMetadataImport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getMetadataImport(request); + console.log(response); + } + + callGetMetadataImport(); + // [END metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js new file mode 100644 index 00000000000..e43c7d1e32f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastore_GetService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callGetService() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getService(request); + console.log(response); + } + + callGetService(); + // [END metastore_v1beta_generated_DataprocMetastore_GetService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js new file mode 100644 index 00000000000..260e0d70212 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js @@ -0,0 +1,91 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1beta_generated_DataprocMetastore_ListBackups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END metastore_v1beta_generated_DataprocMetastore_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js new file mode 100644 index 00000000000..7933d98e2c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js @@ -0,0 +1,91 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListMetadataImports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listMetadataImportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMetadataImports(); + // [END metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js new file mode 100644 index 00000000000..a0c3279e5a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1beta_generated_DataprocMetastore_ListServices_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callListServices() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListServices(); + // [END metastore_v1beta_generated_DataprocMetastore_ListServices_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js new file mode 100644 index 00000000000..db907b07a0a --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js @@ -0,0 +1,88 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(service, backup) { + // [START metastore_v1beta_generated_DataprocMetastore_RestoreService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + */ + // const service = 'abc123' + /** + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + */ + // const backup = 'abc123' + /** + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + */ + // const restoreType = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callRestoreService() { + // Construct request + const request = { + service, + backup, + }; + + // Run request + const [operation] = await metastoreClient.restoreService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreService(); + // [END metastore_v1beta_generated_DataprocMetastore_RestoreService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js new file mode 100644 index 00000000000..588931bd1b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, metadataImport) { + // [START metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + */ + // const metadataImport = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateMetadataImport() { + // Construct request + const request = { + updateMask, + metadataImport, + }; + + // Run request + const [operation] = await metastoreClient.updateMetadataImport(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateMetadataImport(); + // [END metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js new file mode 100644 index 00000000000..f40c0fbe174 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, service) { + // [START metastore_v1beta_generated_DataprocMetastore_UpdateService_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + */ + // const service = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreClient(); + + async function callUpdateService() { + // Construct request + const request = { + updateMask, + service, + }; + + // Run request + const [operation] = await metastoreClient.updateService(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateService(); + // [END metastore_v1beta_generated_DataprocMetastore_UpdateService_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js new file mode 100644 index 00000000000..46d3f5e8ed5 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, federationId, federation) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location in which to create a federation + * service, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + */ + // const federationId = 'abc123' + /** + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callCreateFederation() { + // Construct request + const request = { + parent, + federationId, + federation, + }; + + // Run request + const [operation] = await metastoreClient.createFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js new file mode 100644 index 00000000000..56bfc499c7c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callDeleteFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await metastoreClient.deleteFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js new file mode 100644 index 00000000000..bbbcb0f0d31 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the metastore federation to retrieve, + * in the following form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + */ + // const name = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callGetFederation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await metastoreClient.getFederation(request); + console.log(response); + } + + callGetFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js new file mode 100644 index 00000000000..26bcb306912 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * To retrieve the first page, supply an empty page token. + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specify the ordering of results as described in Sorting + * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + */ + // const orderBy = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callListFederations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await metastoreClient.listFederationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFederations(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js new file mode 100644 index 00000000000..7789d713fe3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(updateMask, federation) { + // [START metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + */ + // const updateMask = {} + /** + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + */ + // const federation = {} + /** + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * The request ID must be a valid + * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + */ + // const requestId = 'abc123' + + // Imports the Metastore library + const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; + + // Instantiates a client + const metastoreClient = new DataprocMetastoreFederationClient(); + + async function callUpdateFederation() { + // Construct request + const request = { + updateMask, + federation, + }; + + // Run request + const [operation] = await metastoreClient.updateFederation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFederation(); + // [END metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json new file mode 100644 index 00000000000..574e60eea15 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json @@ -0,0 +1,987 @@ +{ + "clientLibrary": { + "name": "nodejs-metastore", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.metastore.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListServices_async", + "title": "DataprocMetastore listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists services in a project and location.", + "canonical": true, + "file": "dataproc_metastore.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListServicesResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetService_async", + "title": "DataprocMetastore getService Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single service.", + "canonical": true, + "file": "dataproc_metastore.get_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.Service", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateService_async", + "title": "DataprocMetastore createService Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore service in a project and location.", + "canonical": true, + "file": "dataproc_metastore.create_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "service_id", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1beta.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateService_async", + "title": "DataprocMetastore updateService Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single service.", + "canonical": true, + "file": "dataproc_metastore.update_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "service", + "type": ".google.cloud.metastore.v1beta.Service" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteService_async", + "title": "DataprocMetastore deleteService Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single service.", + "canonical": true, + "file": "dataproc_metastore.delete_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async", + "title": "DataprocMetastore listMetadataImports Sample", + "origin": "API_DEFINITION", + "description": " Lists imports in a service.", + "canonical": true, + "file": "dataproc_metastore.list_metadata_imports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListMetadataImportsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListMetadataImports", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async", + "title": "DataprocMetastore getMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single import.", + "canonical": true, + "file": "dataproc_metastore.get_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.MetadataImport", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async", + "title": "DataprocMetastore createMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Creates a new MetadataImport in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import_id", + "type": "TYPE_STRING" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1beta.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async", + "title": "DataprocMetastore updateMetadataImport Sample", + "origin": "API_DEFINITION", + "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", + "canonical": true, + "file": "dataproc_metastore.update_metadata_import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "metadata_import", + "type": ".google.cloud.metastore.v1beta.MetadataImport" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "UpdateMetadataImport", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async", + "title": "DataprocMetastore exportMetadata Sample", + "origin": "API_DEFINITION", + "description": " Exports metadata from a service.", + "canonical": true, + "file": "dataproc_metastore.export_metadata.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", + "async": true, + "parameters": [ + { + "name": "destination_gcs_folder", + "type": "TYPE_STRING" + }, + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "database_dump_type", + "type": ".google.cloud.metastore.v1beta.DatabaseDumpSpec.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ExportMetadata", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_RestoreService_async", + "title": "DataprocMetastore restoreService Sample", + "origin": "API_DEFINITION", + "description": " Restores a service from a backup.", + "canonical": true, + "file": "dataproc_metastore.restore_service.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", + "async": true, + "parameters": [ + { + "name": "service", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": "TYPE_STRING" + }, + { + "name": "restore_type", + "type": ".google.cloud.metastore.v1beta.Restore.RestoreType" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "RestoreService", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListBackups_async", + "title": "DataprocMetastore listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists backups in a service.", + "canonical": true, + "file": "dataproc_metastore.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListBackupsResponse", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetBackup_async", + "title": "DataprocMetastore getBackup Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single backup.", + "canonical": true, + "file": "dataproc_metastore.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.Backup", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateBackup_async", + "title": "DataprocMetastore createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup in a given project and location.", + "canonical": true, + "file": "dataproc_metastore.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup_id", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.metastore.v1beta.Backup" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async", + "title": "DataprocMetastore deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single backup.", + "canonical": true, + "file": "dataproc_metastore.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", + "service": { + "shortName": "DataprocMetastore", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async", + "title": "DataprocMetastore listFederations Sample", + "origin": "API_DEFINITION", + "description": " Lists federations in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.list_federations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.ListFederationsResponse", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "ListFederations", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async", + "title": "DataprocMetastore getFederation Sample", + "origin": "API_DEFINITION", + "description": " Gets the details of a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.get_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.metastore.v1beta.Federation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "GetFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async", + "title": "DataprocMetastore createFederation Sample", + "origin": "API_DEFINITION", + "description": " Creates a metastore federation in a project and location.", + "canonical": true, + "file": "dataproc_metastore_federation.create_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "federation_id", + "type": "TYPE_STRING" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1beta.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "CreateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async", + "title": "DataprocMetastore updateFederation Sample", + "origin": "API_DEFINITION", + "description": " Updates the fields of a federation.", + "canonical": true, + "file": "dataproc_metastore_federation.update_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "federation", + "type": ".google.cloud.metastore.v1beta.Federation" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "UpdateFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + }, + { + "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async", + "title": "DataprocMetastore deleteFederation Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single federation.", + "canonical": true, + "file": "dataproc_metastore_federation.delete_federation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataprocMetastoreFederationClient", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" + }, + "method": { + "shortName": "DeleteFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", + "service": { + "shortName": "DataprocMetastoreFederation", + "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts new file mode 100644 index 00000000000..d9946ee0feb --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1beta from './v1beta'; +const DataprocMetastoreClient = v1beta.DataprocMetastoreClient; +type DataprocMetastoreClient = v1beta.DataprocMetastoreClient; +const DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; +type DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; +export {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +export default {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts new file mode 100644 index 00000000000..3c4a3c0e9a5 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts @@ -0,0 +1,3173 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta/dataproc_metastore_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore services. + * Metastore services are fully managed, highly available, autoscaled, + * autohealing, OSS-native deployments of technical metadata management + * software. Each metastore service exposes a network endpoint through which + * metadata queries are served. Metadata queries can originate from a variety + * of sources, including Apache Hive, Apache Presto, and Apache Spark. + * + * The Dataproc Metastore API defines the following resource model: + * + * * The service works with a collection of Google Cloud projects, named: + * `/projects/*` + * * Each project has a collection of available locations, named: `/locations/*` + * (a location must refer to a Google Cloud `region`) + * * Each location has a collection of services, named: `/services/*` + * * Dataproc Metastore services are resources with names of the form: + * + * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @class + * @memberof v1beta + */ +export class DataprocMetastoreClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataprocMetastoreClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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 if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + lakePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/lakes/{lake}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listMetadataImports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), + listBackups: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; + const createServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; + const updateServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteServiceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const createMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; + const createMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateMetadataImportResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; + const updateMetadataImportMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const exportMetadataResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.MetadataExport') as gax.protobuf.Type; + const exportMetadataMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const restoreServiceResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Restore') as gax.protobuf.Type; + const restoreServiceMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const createBackupResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Backup') as gax.protobuf.Type; + const createBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteBackupResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteBackupMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createServiceResponse.decode.bind(createServiceResponse), + createServiceMetadata.decode.bind(createServiceMetadata)), + updateService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateServiceResponse.decode.bind(updateServiceResponse), + updateServiceMetadata.decode.bind(updateServiceMetadata)), + deleteService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteServiceResponse.decode.bind(deleteServiceResponse), + deleteServiceMetadata.decode.bind(deleteServiceMetadata)), + createMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createMetadataImportResponse.decode.bind(createMetadataImportResponse), + createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), + updateMetadataImport: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), + updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), + exportMetadata: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportMetadataResponse.decode.bind(exportMetadataResponse), + exportMetadataMetadata.decode.bind(exportMetadataMetadata)), + restoreService: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreServiceResponse.decode.bind(restoreServiceResponse), + restoreServiceMetadata.decode.bind(restoreServiceMetadata)), + createBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createBackupResponse.decode.bind(createBackupResponse), + createBackupMetadata.decode.bind(createBackupMetadata)), + deleteBackup: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteBackupResponse.decode.bind(deleteBackupResponse), + deleteBackupMetadata.decode.bind(deleteBackupMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1beta.DataprocMetastore', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataprocMetastoreStub) { + return this.dataprocMetastoreStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1beta.DataprocMetastore. + this.dataprocMetastoreStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastore') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastore, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataprocMetastoreStubMethods = + ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup']; + for (const methodName of dataprocMetastoreStubMethods) { + const callPromise = this.dataprocMetastoreStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'metastore.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets the details of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Service]{@link google.cloud.metastore.v1beta.Service}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.get_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_GetService_async + */ + getService( + request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined + ]>; + getService( + request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>): void; + getService( + request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IService, + protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } +/** + * Gets details of a single import. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metadata import to retrieve, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.get_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async + */ + getMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|undefined, {}|undefined + ]>; + getMetadataImport( + request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): void; + getMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport, + protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getMetadataImport(request, options, callback); + } +/** + * Gets details of a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to retrieve, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Backup]{@link google.cloud.metastore.v1beta.Backup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.get_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|undefined, {}|undefined + ]>; + getBackup( + request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>): void; + getBackup( + request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup, + protos.google.cloud.metastore.v1beta.IGetBackupRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getBackup(request, options, callback); + } + +/** + * Creates a metastore service in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a + * metastore service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.serviceId + * Required. The ID of the metastore service, which is used as the final + * component of the metastore service's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1beta.Service} request.service + * Required. The Metastore service to create. The `name` field is + * ignored. The ID of the created metastore service must be provided in + * the request's `service_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async + */ + createService( + request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createService( + request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createService( + request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async + */ + async checkCreateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore service resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1beta.Service} request.service + * Required. The metastore service to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore service's `name` field is used to identify the metastore + * service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async + */ + updateService( + request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateService( + request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateService( + request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async + */ + async checkUpdateServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore service to delete, in + * the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async + */ + deleteService( + request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteService( + request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteService( + request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async + */ + async checkDeleteServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new MetadataImport in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * metastore import, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.metadataImportId + * Required. The ID of the metadata import, which is used as the final + * component of the metadata import's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport + * Required. The metadata import to create. The `name` field is ignored. The + * ID of the created metadata import must be provided in the request's + * `metadata_import_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async + */ + createMetadataImport( + request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createMetadataImport( + request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createMetadataImport( + request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async + */ + async checkCreateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates a single import. + * Only the description field of MetadataImport is supported to be updated. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metadata import resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport + * Required. The metadata import to update. The server only merges fields + * in the import if they are specified in `update_mask`. + * + * The metadata import's `name` field is used to identify the metastore + * import to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async + */ + updateMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateMetadataImport( + request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateMetadataImport( + request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'metadata_import.name': request.metadataImport!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateMetadataImport(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateMetadataImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async + */ + async checkUpdateMetadataImportProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports metadata from a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.destinationGcsFolder + * A Cloud Storage URI of a folder, in the format + * `gs:///`. A sub-folder + * `` containing exported files will be created below it. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * export, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {google.cloud.metastore.v1beta.DatabaseDumpSpec.Type} [request.databaseDumpType] + * Optional. The type of the database dump. If unspecified, defaults to + * `MYSQL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async + */ + exportMetadata( + request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportMetadata( + request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportMetadata( + request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportMetadata(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportMetadata()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async + */ + async checkExportMetadataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Restores a service from a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.service + * Required. The relative resource name of the metastore service to run + * restore, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backup + * Required. The relative resource name of the metastore service backup to + * restore from, in the following form: + * + * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {google.cloud.metastore.v1beta.Restore.RestoreType} [request.restoreType] + * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async + */ + restoreService( + request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + restoreService( + request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + restoreService( + request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'service': request.service ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreService(request, options, callback); + } +/** + * Check the status of the long running operation returned by `restoreService()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async + */ + async checkRestoreServiceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new backup in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service in which to create a + * backup of the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}`. + * @param {string} request.backupId + * Required. The ID of the backup, which is used as the final component of the + * backup's name. + * + * This value must be between 1 and 64 characters long, begin with a letter, + * end with a letter or number, and consist of alpha-numeric ASCII characters + * or hyphens. + * @param {google.cloud.metastore.v1beta.Backup} request.backup + * Required. The backup to create. The `name` field is ignored. The ID of the + * created backup must be provided in the request's `backup_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createBackup( + request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createBackup( + request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async + */ + async checkCreateBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the backup to delete, in the + * following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to + * ignore the request if it has completed. The server will ignore subsequent + * requests that provide a duplicate request ID for at least 60 minutes after + * the first request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteBackup( + request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteBackup( + request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteBackup(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteBackup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async + */ + async checkDeleteBackupProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists services in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.metastore.v1beta.Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServices( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IService[], + protos.google.cloud.metastore.v1beta.IListServicesRequest|null, + protos.google.cloud.metastore.v1beta.IListServicesResponse + ]>; + listServices( + request: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>): void; + listServices( + request: protos.google.cloud.metastore.v1beta.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>): void; + listServices( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListServicesRequest, + protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IService>): + Promise<[ + protos.google.cloud.metastore.v1beta.IService[], + protos.google.cloud.metastore.v1beta.IListServicesRequest|null, + protos.google.cloud.metastore.v1beta.IListServicesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.cloud.metastore.v1beta.Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServicesStream( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore services + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of services to return. The response may + * contain less than the maximum number. If unspecified, no more than 500 + * services are returned. The maximum value is 1000; values above 1000 are + * changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Service]{@link google.cloud.metastore.v1beta.Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.list_services.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ListServices_async + */ + listServicesAsync( + request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists imports in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetadataImports( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport[], + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse + ]>; + listMetadataImports( + request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>): void; + listMetadataImports( + request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>): void; + listMetadataImports( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IMetadataImport>): + Promise<[ + protos.google.cloud.metastore.v1beta.IMetadataImport[], + protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, + protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listMetadataImports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMetadataImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetadataImportsStream( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.createStream( + this.innerApiCalls.listMetadataImports as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMetadataImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose metadata imports + * to list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. + * @param {number} [request.pageSize] + * Optional. The maximum number of imports to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 imports are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async + */ + listMetadataImportsAsync( + request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMetadataImports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMetadataImports.asyncIterate( + this.innerApiCalls['listMetadataImports'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists backups in a service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Backup]{@link google.cloud.metastore.v1beta.Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup[], + protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, + protos.google.cloud.metastore.v1beta.IListBackupsResponse + ]>; + listBackups( + request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>): void; + listBackups( + request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>): void; + listBackups( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListBackupsRequest, + protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IBackup>): + Promise<[ + protos.google.cloud.metastore.v1beta.IBackup[], + protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, + protos.google.cloud.metastore.v1beta.IListBackupsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listBackups(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Backup]{@link google.cloud.metastore.v1beta.Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the service whose backups to + * list, in the following form: + * + * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. + * @param {number} [request.pageSize] + * Optional. The maximum number of backups to return. The response may contain + * less than the maximum number. If unspecified, no more than 500 backups are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Backup]{@link google.cloud.metastore.v1beta.Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore.list_backups.js + * region_tag:metastore_v1beta_generated_DataprocMetastore_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified lake resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} lake + * @returns {string} Resource name string. + */ + lakePath(project:string,location:string,lake:string) { + return this.pathTemplates.lakePathTemplate.render({ + project: project, + location: location, + lake: lake, + }); + } + + /** + * Parse the project from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).project; + } + + /** + * Parse the location from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).location; + } + + /** + * Parse the lake from Lake resource. + * + * @param {string} lakeName + * A fully-qualified path representing Lake resource. + * @returns {string} A string representing the lake. + */ + matchLakeFromLakeName(lakeName: string) { + return this.pathTemplates.lakePathTemplate.match(lakeName).lake; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project:string,network:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataprocMetastoreStub && !this._terminated) { + return this.dataprocMetastoreStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json new file mode 100644 index 00000000000..0a770678945 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json @@ -0,0 +1,113 @@ +{ + "interfaces": { + "google.cloud.metastore.v1beta.DataprocMetastore": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListServices": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetService": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListMetadataImports": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMetadataImport": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExportMetadata": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreService": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts new file mode 100644 index 00000000000..dab59f4908f --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts @@ -0,0 +1,1725 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta/dataproc_metastore_federation_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Configures and manages metastore federation services. + * Dataproc Metastore Federation Service allows federating a collection of + * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc + * Metastores. The Federation Service exposes a gRPC URL through which metadata + * from the backend metastores are served at query time. + * + * The Dataproc Metastore Federation API defines the following resource model: + * * The service works with a collection of Google Cloud projects. + * * Each project has a collection of available locations. + * * Each location has a collection of federations. + * * Dataproc Metastore Federations are resources with names of the + * form: + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @class + * @memberof v1beta + */ +export class DataprocMetastoreFederationClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DataprocMetastoreFederationClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataprocMetastoreFederationClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // 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 if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' + ), + federationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/federations/{federation}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + metadataImportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listFederations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; + const createFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const updateFederationResponse = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; + const updateFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + const deleteFederationResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFederationMetadata = protoFilesRoot.lookup( + '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFederationResponse.decode.bind(createFederationResponse), + createFederationMetadata.decode.bind(createFederationMetadata)), + updateFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFederationResponse.decode.bind(updateFederationResponse), + updateFederationMetadata.decode.bind(updateFederationMetadata)), + deleteFederation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFederationResponse.decode.bind(deleteFederationResponse), + deleteFederationMetadata.decode.bind(deleteFederationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.metastore.v1beta.DataprocMetastoreFederation', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataprocMetastoreFederationStub) { + return this.dataprocMetastoreFederationStub; + } + + // Put together the "service stub" for + // google.cloud.metastore.v1beta.DataprocMetastoreFederation. + this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastoreFederation') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastoreFederation, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataprocMetastoreFederationStubMethods = + ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; + for (const methodName of dataprocMetastoreFederationStubMethods) { + const callPromise = this.dataprocMetastoreFederationStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataprocMetastoreFederationStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'metastore.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'metastore.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets the details of a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to retrieve, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Federation]{@link google.cloud.metastore.v1beta.Federation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.get_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async + */ + getFederation( + request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|undefined, {}|undefined + ]>; + getFederation( + request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + callback: Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>): void; + getFederation( + request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation, + protos.google.cloud.metastore.v1beta.IGetFederationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFederation(request, options, callback); + } + +/** + * Creates a metastore federation in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location in which to create a federation + * service, in the following form: + * + * `projects/{project_number}/locations/{location_id}`. + * @param {string} request.federationId + * Required. The ID of the metastore federation, which is used as the final + * component of the metastore federation's name. + * + * This value must be between 2 and 63 characters long inclusive, begin with a + * letter, end with a letter or number, and consist of alpha-numeric + * ASCII characters or hyphens. + * @param {google.cloud.metastore.v1beta.Federation} request.federation + * Required. The Metastore Federation to create. The `name` field is + * ignored. The ID of the created metastore federation must be + * provided in the request's `federation_id` field. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async + */ + createFederation( + request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFederation( + request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFederation( + request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async + */ + async checkCreateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the fields of a federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. A field mask used to specify the fields to be overwritten in the + * metastore federation resource by the update. + * Fields specified in the `update_mask` are relative to the resource (not + * to the full request). A field is overwritten if it is in the mask. + * @param {google.cloud.metastore.v1beta.Federation} request.federation + * Required. The metastore federation to update. The server only merges fields + * in the service if they are specified in `update_mask`. + * + * The metastore federation's `name` field is used to identify the + * metastore service to be updated. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + updateFederation( + request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFederation( + request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFederation( + request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'federation.name': request.federation!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async + */ + async checkUpdateFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single federation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the metastore federation to delete, + * in the following form: + * + * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. + * @param {string} [request.requestId] + * Optional. A request ID. Specify a unique request ID to allow the server to ignore the + * request if it has completed. The server will ignore subsequent requests + * that provide a duplicate request ID for at least 60 minutes after the first + * request. + * + * For example, if an initial request times out, followed by another request + * with the same request ID, the server ignores the second request to prevent + * the creation of duplicate commitments. + * + * The request ID must be a valid + * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) + * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + deleteFederation( + request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFederation( + request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFederation( + request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFederation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteFederation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async + */ + async checkDeleteFederationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists federations in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Federation]{@link google.cloud.metastore.v1beta.Federation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFederations( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation[], + protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, + protos.google.cloud.metastore.v1beta.IListFederationsResponse + ]>; + listFederations( + request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>): void; + listFederations( + request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + callback: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>): void; + listFederations( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>, + callback?: PaginationCallback< + protos.google.cloud.metastore.v1beta.IListFederationsRequest, + protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, + protos.google.cloud.metastore.v1beta.IFederation>): + Promise<[ + protos.google.cloud.metastore.v1beta.IFederation[], + protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, + protos.google.cloud.metastore.v1beta.IListFederationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFederations(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Federation]{@link google.cloud.metastore.v1beta.Federation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFederationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFederationsStream( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.createStream( + this.innerApiCalls.listFederations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFederations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative resource name of the location of metastore federations + * to list, in the following form: + * `projects/{project_number}/locations/{location_id}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of federations to return. The response may contain less + * than the maximum number. If unspecified, no more than 500 services are + * returned. The maximum value is 1000; values above 1000 are changed to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous ListFederationServices + * call. Provide this token to retrieve the subsequent page. + * + * To retrieve the first page, supply an empty page token. + * + * When paginating, other parameters provided to + * ListFederationServices must match the call that provided the + * page token. + * @param {string} [request.filter] + * Optional. The filter to apply to list results. + * @param {string} [request.orderBy] + * Optional. Specify the ordering of results as described in [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * If not specified, the results will be sorted in the default order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Federation]{@link google.cloud.metastore.v1beta.Federation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta/dataproc_metastore_federation.list_federations.js + * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async + */ + listFederationsAsync( + request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFederations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFederations.asyncIterate( + this.innerApiCalls['listFederations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,service:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + service: service, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the service from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the service. + */ + matchServiceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).service; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified federation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} federation + * @returns {string} Resource name string. + */ + federationPath(project:string,location:string,federation:string) { + return this.pathTemplates.federationPathTemplate.render({ + project: project, + location: location, + federation: federation, + }); + } + + /** + * Parse the project from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).project; + } + + /** + * Parse the location from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).location; + } + + /** + * Parse the federation from Federation resource. + * + * @param {string} federationName + * A fully-qualified path representing Federation resource. + * @returns {string} A string representing the federation. + */ + matchFederationFromFederationName(federationName: string) { + return this.pathTemplates.federationPathTemplate.match(federationName).federation; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified metadataImport resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} metadata_import + * @returns {string} Resource name string. + */ + metadataImportPath(project:string,location:string,service:string,metadataImport:string) { + return this.pathTemplates.metadataImportPathTemplate.render({ + project: project, + location: location, + service: service, + metadata_import: metadataImport, + }); + } + + /** + * Parse the project from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; + } + + /** + * Parse the location from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the location. + */ + matchLocationFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; + } + + /** + * Parse the service from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the service. + */ + matchServiceFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; + } + + /** + * Parse the metadata_import from MetadataImport resource. + * + * @param {string} metadataImportName + * A fully-qualified path representing MetadataImport resource. + * @returns {string} A string representing the metadata_import. + */ + matchMetadataImportFromMetadataImportName(metadataImportName: string) { + return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project:string,location:string,service:string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataprocMetastoreFederationStub && !this._terminated) { + return this.dataprocMetastoreFederationStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json new file mode 100644 index 00000000000..e6e1944d917 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.metastore.v1beta.DataprocMetastoreFederation": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListFederations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFederation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json new file mode 100644 index 00000000000..aaeb52eb5c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1beta/metastore.proto", + "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json new file mode 100644 index 00000000000..aaeb52eb5c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/metastore/v1beta/metastore.proto", + "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" +] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..fdbbd5e20ca --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,253 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.metastore.v1beta", + "libraryPackage": "@google-cloud/dataproc-metastore", + "services": { + "DataprocMetastore": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreClient", + "rpcs": { + "GetService": { + "methods": [ + "getService" + ] + }, + "GetMetadataImport": { + "methods": [ + "getMetadataImport" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "CreateService": { + "methods": [ + "createService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateMetadataImport": { + "methods": [ + "createMetadataImport" + ] + }, + "UpdateMetadataImport": { + "methods": [ + "updateMetadataImport" + ] + }, + "ExportMetadata": { + "methods": [ + "exportMetadata" + ] + }, + "RestoreService": { + "methods": [ + "restoreService" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListMetadataImports": { + "methods": [ + "listMetadataImports", + "listMetadataImportsStream", + "listMetadataImportsAsync" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "DataprocMetastoreFederation": { + "clients": { + "grpc": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataprocMetastoreFederationClient", + "rpcs": { + "GetFederation": { + "methods": [ + "getFederation" + ] + }, + "CreateFederation": { + "methods": [ + "createFederation" + ] + }, + "UpdateFederation": { + "methods": [ + "updateFederation" + ] + }, + "DeleteFederation": { + "methods": [ + "deleteFederation" + ] + }, + "ListFederations": { + "methods": [ + "listFederations", + "listFederationsStream", + "listFederationsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts new file mode 100644 index 00000000000..3e1ee876b29 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {DataprocMetastoreClient} from './dataproc_metastore_client'; +export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..74e7a6657af --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const metastore = require('@google-cloud/dataproc-metastore'); + +function main() { + const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); + const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..f10cef1cd2c --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; + +// check that the client class type name can be used +function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { + client.close(); +} +function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const dataprocMetastoreClient = new DataprocMetastoreClient(); + doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); + // check that the client instance can be created + const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); + doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts new file mode 100644 index 00000000000..2fc7477b5b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts @@ -0,0 +1,2000 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as dataprocmetastorefederationModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta.DataprocMetastoreFederationClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreFederationStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreFederationStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getFederation', () => { + it('invokes getFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); + const [response] = await client.getFederation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Federation() + ); + client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFederation( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFederation with closed client', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFederation(request), expectedError); + }); + }); + + describe('createFederation', () => { + it('invokes createFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFederation', () => { + it('invokes updateFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() + ); + request.federation ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); + request.federation.name = defaultValue1; + const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFederation', () => { + it('invokes deleteFederation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFederation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFederation( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with call error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFederation(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFederation with LRO error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFederation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteFederationProgress without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFederationProgress with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFederations', () => { + it('invokes listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); + const [response] = await client.listFederations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFederations( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFederations(request), expectedError); + const actualRequest = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFederationsStream without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listFederationsStream with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFederationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); + assert( + (client.descriptors.page.listFederations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), + ]; + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; + const iterable = client.listFederationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listFederations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListFederationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFederationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listFederations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts new file mode 100644 index 00000000000..7de65156fdc --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts @@ -0,0 +1,3718 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as dataprocmetastoreModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta.DataprocMetastoreClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + await client.initialize(); + assert(client.dataprocMetastoreStub); + }); + + it('has close method for the initialized client', done => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.dataprocMetastoreStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.dataprocMetastoreStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getService', () => { + it('invokes getService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Service() + ); + client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('getMetadataImport', () => { + it('invokes getMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); + const [response] = await client.getMetadataImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.MetadataImport() + ); + client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetadataImport( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetadataImport with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetadataImport(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.Backup() + ); + client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.GetBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); + const [operation] = await client.createService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() + ); + request.service ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createMetadataImport', () => { + it('invokes createMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.createMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateMetadataImport', () => { + it('invokes updateMetadataImport without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMetadataImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMetadataImport( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateMetadataImport(request), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateMetadataImport with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() + ); + request.metadataImport ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); + request.metadataImport.name = defaultValue1; + const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateMetadataImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateMetadataImportProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateMetadataImportProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportMetadata', () => { + it('invokes exportMetadata without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportMetadata(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportMetadata( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportMetadata(request), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportMetadata with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportMetadata(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportMetadataProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportMetadataProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportMetadataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('restoreService', () => { + it('invokes restoreService without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreService(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreService( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreService(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreService with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); + request.service = defaultValue1; + const expectedHeaderRequestParams = `service=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreService(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreServiceProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreServiceProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.CreateBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteBackup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with call error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with LRO error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteBackup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteBackupProgress without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteBackupProgress with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Service[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListServicesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMetadataImports', () => { + it('invokes listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); + const [response] = await client.listMetadataImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetadataImports( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMetadataImports(request), expectedError); + const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMetadataImportsStream without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMetadataImportsStream with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetadataImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); + assert( + (client.descriptors.page.listMetadataImports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), + ]; + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; + const iterable = client.listMetadataImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMetadataImports with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetadataImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; + stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.metastore.v1beta.ListBackupsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('backup', () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + backup: "backupValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromBackupName', () => { + const result = client.matchServiceFromBackupName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('federation', () => { + const fakePath = "/rendered/path/federation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + federation: "federationValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.federationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.federationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('federationPath', () => { + const result = client.federationPath("projectValue", "locationValue", "federationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.federationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFederationName', () => { + const result = client.matchProjectFromFederationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromFederationName', () => { + const result = client.matchLocationFromFederationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFederationFromFederationName', () => { + const result = client.matchFederationFromFederationName(fakePath); + assert.strictEqual(result, "federationValue"); + assert((client.pathTemplates.federationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('lake', () => { + const fakePath = "/rendered/path/lake"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + lake: "lakeValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.lakePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.lakePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('lakePath', () => { + const result = client.lakePath("projectValue", "locationValue", "lakeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.lakePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLakeName', () => { + const result = client.matchProjectFromLakeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLakeName', () => { + const result = client.matchLocationFromLakeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLakeFromLakeName', () => { + const result = client.matchLakeFromLakeName(fakePath); + assert.strictEqual(result, "lakeValue"); + assert((client.pathTemplates.lakePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('metadataImport', () => { + const fakePath = "/rendered/path/metadataImport"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + metadata_import: "metadataImportValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.metadataImportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.metadataImportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('metadataImportPath', () => { + const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromMetadataImportName', () => { + const result = client.matchProjectFromMetadataImportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromMetadataImportName', () => { + const result = client.matchLocationFromMetadataImportName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromMetadataImportName', () => { + const result = client.matchServiceFromMetadataImportName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMetadataImportFromMetadataImportName', () => { + const result = client.matchMetadataImportFromMetadataImportName(fakePath); + assert.strictEqual(result, "metadataImportValue"); + assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + network: "networkValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "networkValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, "networkValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + service: "serviceValue", + }; + const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath("projectValue", "locationValue", "serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js new file mode 100644 index 00000000000..6fc45cb3d30 --- /dev/null +++ b/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'DataprocMetastore', + filename: './dataproc-metastore.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 4573de5ae083a57b0cd5ec4f1f50114a2178f5d7 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 5 Dec 2022 23:07:00 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../google-cloud-metastore/v1/.eslintignore | 7 - .../google-cloud-metastore/v1/.eslintrc.json | 3 - .../google-cloud-metastore/v1/.gitignore | 14 - .../google-cloud-metastore/v1/.jsdoc.js | 55 - .../google-cloud-metastore/v1/.mocharc.js | 33 - .../google-cloud-metastore/v1/.prettierrc.js | 22 - .../google-cloud-metastore/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../google-cloud-metastore/v1/package.json | 65 - .../google/cloud/metastore/v1/metastore.proto | 1316 ------ .../metastore/v1/metastore_federation.proto | 361 -- .../v1/dataproc_metastore.create_backup.js | 92 - ...taproc_metastore.create_metadata_import.js | 93 - .../v1/dataproc_metastore.create_service.js | 93 - .../v1/dataproc_metastore.delete_backup.js | 77 - .../v1/dataproc_metastore.delete_service.js | 77 - .../v1/dataproc_metastore.export_metadata.js | 87 - .../v1/dataproc_metastore.get_backup.js | 63 - .../dataproc_metastore.get_metadata_import.js | 63 - .../v1/dataproc_metastore.get_service.js | 63 - .../v1/dataproc_metastore.list_backups.js | 90 - ...ataproc_metastore.list_metadata_imports.js | 90 - .../v1/dataproc_metastore.list_services.js | 90 - .../v1/dataproc_metastore.restore_service.js | 88 - ...taproc_metastore.update_metadata_import.js | 86 - .../v1/dataproc_metastore.update_service.js | 86 - ..._metastore_federation.create_federation.js | 93 - ..._metastore_federation.delete_federation.js | 77 - ...roc_metastore_federation.get_federation.js | 63 - ...c_metastore_federation.list_federations.js | 90 - ..._metastore_federation.update_federation.js | 86 - ...et_metadata.google.cloud.metastore.v1.json | 987 ----- .../google-cloud-metastore/v1/src/index.ts | 27 - .../v1/src/v1/dataproc_metastore_client.ts | 3108 -------------- .../v1/dataproc_metastore_client_config.json | 113 - .../dataproc_metastore_federation_client.ts | 1725 -------- ...oc_metastore_federation_client_config.json | 46 - ...aproc_metastore_federation_proto_list.json | 4 - .../src/v1/dataproc_metastore_proto_list.json | 4 - .../v1/src/v1/gapic_metadata.json | 253 -- .../google-cloud-metastore/v1/src/v1/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1/system-test/install.ts | 49 - .../gapic_dataproc_metastore_federation_v1.ts | 2000 --------- .../v1/test/gapic_dataproc_metastore_v1.ts | 3672 ---------------- .../google-cloud-metastore/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1alpha/.eslintignore | 7 - .../v1alpha/.eslintrc.json | 3 - .../google-cloud-metastore/v1alpha/.gitignore | 14 - .../google-cloud-metastore/v1alpha/.jsdoc.js | 55 - .../v1alpha/.mocharc.js | 33 - .../v1alpha/.prettierrc.js | 22 - .../google-cloud-metastore/v1alpha/README.md | 1 - .../v1alpha/linkinator.config.json | 16 - .../v1alpha/package.json | 65 - .../cloud/metastore/v1alpha/metastore.proto | 1462 ------- .../v1alpha/metastore_federation.proto | 364 -- .../dataproc_metastore.create_backup.js | 92 - ...taproc_metastore.create_metadata_import.js | 93 - .../dataproc_metastore.create_service.js | 93 - .../dataproc_metastore.delete_backup.js | 77 - .../dataproc_metastore.delete_service.js | 77 - .../dataproc_metastore.export_metadata.js | 88 - .../v1alpha/dataproc_metastore.get_backup.js | 63 - .../dataproc_metastore.get_metadata_import.js | 63 - .../v1alpha/dataproc_metastore.get_service.js | 63 - .../dataproc_metastore.list_backups.js | 91 - ...ataproc_metastore.list_metadata_imports.js | 91 - .../dataproc_metastore.list_services.js | 92 - .../dataproc_metastore.restore_service.js | 88 - ...taproc_metastore.update_metadata_import.js | 86 - .../dataproc_metastore.update_service.js | 86 - ..._metastore_federation.create_federation.js | 93 - ..._metastore_federation.delete_federation.js | 77 - ...roc_metastore_federation.get_federation.js | 63 - ...c_metastore_federation.list_federations.js | 90 - ..._metastore_federation.update_federation.js | 86 - ...tadata.google.cloud.metastore.v1alpha.json | 987 ----- .../v1alpha/src/index.ts | 27 - .../src/v1alpha/dataproc_metastore_client.ts | 3173 -------------- .../dataproc_metastore_client_config.json | 113 - .../dataproc_metastore_federation_client.ts | 1725 -------- ...oc_metastore_federation_client_config.json | 46 - ...aproc_metastore_federation_proto_list.json | 4 - .../dataproc_metastore_proto_list.json | 4 - .../v1alpha/src/v1alpha/gapic_metadata.json | 253 -- .../v1alpha/src/v1alpha/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1alpha/system-test/install.ts | 49 - ...c_dataproc_metastore_federation_v1alpha.ts | 2000 --------- .../test/gapic_dataproc_metastore_v1alpha.ts | 3718 ----------------- .../v1alpha/tsconfig.json | 19 - .../v1alpha/webpack.config.js | 64 - .../v1beta/.eslintignore | 7 - .../v1beta/.eslintrc.json | 3 - .../google-cloud-metastore/v1beta/.gitignore | 14 - .../google-cloud-metastore/v1beta/.jsdoc.js | 55 - .../google-cloud-metastore/v1beta/.mocharc.js | 33 - .../v1beta/.prettierrc.js | 22 - .../google-cloud-metastore/v1beta/README.md | 1 - .../v1beta/linkinator.config.json | 16 - .../v1beta/package.json | 65 - .../cloud/metastore/v1beta/metastore.proto | 1462 ------- .../v1beta/metastore_federation.proto | 364 -- .../dataproc_metastore.create_backup.js | 92 - ...taproc_metastore.create_metadata_import.js | 93 - .../dataproc_metastore.create_service.js | 93 - .../dataproc_metastore.delete_backup.js | 77 - .../dataproc_metastore.delete_service.js | 77 - .../dataproc_metastore.export_metadata.js | 88 - .../v1beta/dataproc_metastore.get_backup.js | 63 - .../dataproc_metastore.get_metadata_import.js | 63 - .../v1beta/dataproc_metastore.get_service.js | 63 - .../v1beta/dataproc_metastore.list_backups.js | 91 - ...ataproc_metastore.list_metadata_imports.js | 91 - .../dataproc_metastore.list_services.js | 92 - .../dataproc_metastore.restore_service.js | 88 - ...taproc_metastore.update_metadata_import.js | 86 - .../dataproc_metastore.update_service.js | 86 - ..._metastore_federation.create_federation.js | 93 - ..._metastore_federation.delete_federation.js | 77 - ...roc_metastore_federation.get_federation.js | 63 - ...c_metastore_federation.list_federations.js | 90 - ..._metastore_federation.update_federation.js | 86 - ...etadata.google.cloud.metastore.v1beta.json | 987 ----- .../v1beta/src/index.ts | 27 - .../src/v1beta/dataproc_metastore_client.ts | 3173 -------------- .../dataproc_metastore_client_config.json | 113 - .../dataproc_metastore_federation_client.ts | 1725 -------- ...oc_metastore_federation_client_config.json | 46 - ...aproc_metastore_federation_proto_list.json | 4 - .../v1beta/dataproc_metastore_proto_list.json | 4 - .../v1beta/src/v1beta/gapic_metadata.json | 253 -- .../v1beta/src/v1beta/index.ts | 20 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - .../v1beta/system-test/install.ts | 49 - ...ic_dataproc_metastore_federation_v1beta.ts | 2000 --------- .../test/gapic_dataproc_metastore_v1beta.ts | 3718 ----------------- .../v1beta/tsconfig.json | 19 - .../v1beta/webpack.config.js | 64 - .../cloud/metastore/v1beta/metastore.proto | 2 +- 145 files changed, 1 insertion(+), 47622 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/README.md delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/package.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.gitignore delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/README.md delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/package.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js diff --git a/owl-bot-staging/google-cloud-metastore/v1/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/.gitignore b/owl-bot-staging/google-cloud-metastore/v1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js deleted file mode 100644 index bc8b6fc164f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dataproc-metastore', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/README.md b/owl-bot-staging/google-cloud-metastore/v1/README.md deleted file mode 100644 index 24afb9017c6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json b/owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/package.json b/owl-bot-staging/google-cloud-metastore/v1/package.json deleted file mode 100644 index b3e0a6424ad..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/dataproc-metastore", - "version": "0.1.0", - "description": "Metastore client for Node.js", - "repository": "googleapis/nodejs-metastore", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google metastore", - "metastore", - "dataproc metastore", - "dataproc metastore federation" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto deleted file mode 100644 index 01431d9c12f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore.proto +++ /dev/null @@ -1,1316 +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.metastore.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/dayofweek.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1;metastore"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreProto"; -option java_package = "com.google.cloud.metastore.v1"; -option php_namespace = "Google\\Cloud\\Metastore\\V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Subnetwork" - pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" -}; - -// Configures and manages metastore services. -// Metastore services are fully managed, highly available, autoscaled, -// autohealing, OSS-native deployments of technical metadata management -// software. Each metastore service exposes a network endpoint through which -// metadata queries are served. Metadata queries can originate from a variety -// of sources, including Apache Hive, Apache Presto, and Apache Spark. -// -// The Dataproc Metastore API defines the following resource model: -// -// * The service works with a collection of Google Cloud projects, named: -// `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// (a location must refer to a Google Cloud `region`) -// * Each location has a collection of services, named: `/services/*` -// * Dataproc Metastore services are resources with names of the form: -// -// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. -service DataprocMetastore { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists services in a project and location. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single service. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore service in a project and location. - rpc CreateService(CreateServiceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service,service_id"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Updates the parameters of a single service. - rpc UpdateService(UpdateServiceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{service.name=projects/*/locations/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Deletes a single service. - rpc DeleteService(DeleteServiceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Lists imports in a service. - rpc ListMetadataImports(ListMetadataImportsRequest) returns (ListMetadataImportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single import. - rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/services/*/metadataImports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new MetadataImport in a given project and location. - rpc CreateMetadataImport(CreateMetadataImportRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/services/*}/metadataImports" - body: "metadata_import" - }; - option (google.api.method_signature) = "parent,metadata_import,metadata_import_id"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Updates a single import. - // Only the description field of MetadataImport is supported to be updated. - rpc UpdateMetadataImport(UpdateMetadataImportRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" - body: "metadata_import" - }; - option (google.api.method_signature) = "metadata_import,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Exports metadata from a service. - rpc ExportMetadata(ExportMetadataRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:exportMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MetadataExport" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Restores a service from a backup. - rpc RestoreService(RestoreServiceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{service=projects/*/locations/*/services/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "service,backup"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Lists backups in a service. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/services/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new backup in a given project and location. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/services/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Deletes a single backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } -} - -// A managed metastore service that serves metadata queries. -message Service { - option (google.api.resource) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" - }; - - // The current state of the metastore service. - enum State { - // The state of the metastore service is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore service is in the process of being created. - CREATING = 1; - - // The metastore service is running and ready to serve queries. - ACTIVE = 2; - - // The metastore service is entering suspension. Its query-serving - // availability may cease unexpectedly. - SUSPENDING = 3; - - // The metastore service is suspended and unable to serve queries. - SUSPENDED = 4; - - // The metastore service is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 5; - - // The metastore service is undergoing deletion. It cannot be used. - DELETING = 6; - - // The metastore service has encountered an error and cannot be used. The - // metastore service should be deleted. - ERROR = 7; - } - - // Available service tiers. - enum Tier { - // The tier is not set. - TIER_UNSPECIFIED = 0; - - // The developer tier provides limited scalability and no fault tolerance. - // Good for low-cost proof-of-concept. - DEVELOPER = 1; - - // The enterprise tier provides multi-zone high availability, and sufficient - // scalability for enterprise-level Dataproc Metastore workloads. - ENTERPRISE = 3; - } - - // Release channels bundle features of varying levels of stability. Newer - // features may be introduced initially into less stable release channels and - // can be automatically promoted into more stable release channels. - enum ReleaseChannel { - // Release channel is not specified. - RELEASE_CHANNEL_UNSPECIFIED = 0; - - // The `CANARY` release channel contains the newest features, which may be - // unstable and subject to unresolved issues with no known workarounds. - // Services using the `CANARY` release channel are not subject to any SLAs. - CANARY = 1; - - // The `STABLE` release channel contains features that are considered stable - // and have been validated for production use. - STABLE = 2; - } - - // The backend database type for the metastore service. - enum DatabaseType { - // The DATABASE_TYPE is not set. - DATABASE_TYPE_UNSPECIFIED = 0; - - // MySQL is used to persist the metastore data. - MYSQL = 1; - - // Spanner is used to persist the metastore data. - SPANNER = 2; - } - - // Configuration properties specific to the underlying metastore service - // technology (the software that serves metastore queries). - oneof metastore_config { - // Configuration information specific to running Hive metastore - // software as the metastore service. - HiveMetastoreConfig hive_metastore_config = 5; - } - - // Immutable. The relative resource name of the metastore service, in the following - // format: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore service was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore service was last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore service. - map labels = 4; - - // Immutable. The relative resource name of the VPC network on which the instance can be - // accessed. It is specified in the following form: - // - // `projects/{project_number}/global/networks/{network_id}`. - string network = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Network" - } - ]; - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The TCP port at which the metastore service is reached. Default: 9083. - int32 port = 9; - - // Output only. The current state of the metastore service. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the metastore service, if - // available. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A Cloud Storage URI (starting with `gs://`) that specifies where artifacts - // related to the metastore service are stored. - string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The tier of the service. - Tier tier = 13; - - // The one hour maintenance window of the metastore service. This specifies - // when the service can be restarted for maintenance purposes in UTC time. - // Maintenance window is not needed for services with the SPANNER - // database type. - MaintenanceWindow maintenance_window = 15; - - // Output only. The globally unique resource identifier of the metastore service. - string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The metadata management activities of the metastore service. - MetadataManagementActivity metadata_management_activity = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The release channel of the service. - // If unspecified, defaults to `STABLE`. - ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Information used to configure the Dataproc Metastore service to encrypt - // customer data at rest. Cannot be updated. - EncryptionConfig encryption_config = 20 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying the network settings for the - // Dataproc Metastore service. - NetworkConfig network_config = 21; - - // Immutable. The database type that the Metastore service stores its data. - DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying telemetry settings for the Dataproc Metastore - // service. If unspecified defaults to `JSON`. - TelemetryConfig telemetry_config = 23; -} - -// Maintenance window. This specifies when Dataproc Metastore -// may perform system maintenance operation to the service. -message MaintenanceWindow { - // The hour of day (0-23) when the window starts. - google.protobuf.Int32Value hour_of_day = 1; - - // The day of week, when the window starts. - google.type.DayOfWeek day_of_week = 2; -} - -// Specifies configuration information specific to running Hive metastore -// software as the metastore service. -message HiveMetastoreConfig { - // Immutable. The Hive metastore schema version. - string version = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // Hive metastore (configured in `hive-site.xml`). The mappings - // override system defaults (some keys cannot be overridden). These - // overrides are also applied to auxiliary versions and can be further - // customized in the auxiliary version's `AuxiliaryVersionConfig`. - map config_overrides = 2; - - // Information used to configure the Hive metastore service as a service - // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` - // method and specify this field's path - // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` - // while omitting this field from the request's `service`. - KerberosConfig kerberos_config = 3; -} - -// Configuration information for a Kerberos principal. -message KerberosConfig { - // A Kerberos keytab file that can be used to authenticate a service principal - // with a Kerberos Key Distribution Center (KDC). - Secret keytab = 1; - - // A Kerberos principal that exists in the both the keytab the KDC - // to authenticate as. A typical principal is of the form - // `primary/instance@REALM`, but there is no exact format. - string principal = 2; - - // A Cloud Storage URI that specifies the path to a - // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, - // although the file does not need to be named krb5.conf explicitly. - string krb5_config_gcs_uri = 3; -} - -// A securely stored value. -message Secret { - oneof value { - // The relative resource name of a Secret Manager secret version, in the - // following form: - // - // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. - string cloud_secret = 2; - } -} - -// Encryption settings for the service. -message EncryptionConfig { - // The fully qualified customer provided Cloud KMS key name to use for - // customer data encryption, in the following form: - // - // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. - string kms_key = 1; -} - -// Network configuration for the Dataproc Metastore service. -message NetworkConfig { - // Contains information of the customer's network configurations. - message Consumer { - oneof vpc_resource { - // Immutable. The subnetwork of the customer project from which an IP address is - // reserved and used as the Dataproc Metastore service's - // endpoint. It is accessible to hosts in the subnet and to all - // hosts in a subnet in the same region and same network. There must - // be at least one IP address available in the subnet's primary range. The - // subnet is specified in the following form: - // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` - string subnetwork = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Subnetwork" - } - ]; - } - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Immutable. The consumer-side network configuration for the Dataproc Metastore - // instance. - repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; -} - -// Telemetry Configuration for the Dataproc Metastore service. -message TelemetryConfig { - enum LogFormat { - // The LOG_FORMAT is not set. - LOG_FORMAT_UNSPECIFIED = 0; - - // Logging output uses the legacy `textPayload` format. - LEGACY = 1; - - // Logging output uses the `jsonPayload` format. - JSON = 2; - } - - // The output format of the Dataproc Metastore service's logs. - LogFormat log_format = 1; -} - -// The metadata management activities of the metastore service. -message MetadataManagementActivity { - // Output only. The latest metadata exports of the metastore service. - repeated MetadataExport metadata_exports = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The latest restores of the metastore service. - repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A metastore resource that imports metadata. -message MetadataImport { - option (google.api.resource) = { - type: "metastore.googleapis.com/MetadataImport" - pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" - }; - - // A specification of the location of and metadata about a database dump from - // a relational database management system. - message DatabaseDump { - - // The type of the database. - enum DatabaseType { - // The type of the source database is unknown. - DATABASE_TYPE_UNSPECIFIED = 0; - - // The type of the source database is MySQL. - MYSQL = 1; - } - - // The type of the database. - DatabaseType database_type = 1 [deprecated = true]; - - // A Cloud Storage object or folder URI that specifies the source from which - // to import metadata. It must begin with `gs://`. - string gcs_uri = 2; - - // Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. - DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The current state of the metadata import. - enum State { - // The state of the metadata import is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata import is running. - RUNNING = 1; - - // The metadata import completed successfully. - SUCCEEDED = 2; - - // The metadata import is being updated. - UPDATING = 3; - - // The metadata import failed, and attempted metadata changes were rolled - // back. - FAILED = 4; - } - - // The metadata to be imported. - oneof metadata { - // Immutable. A database dump from a pre-existing metastore's database. - DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Immutable. The relative resource name of the metadata import, of the form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The description of the metadata import. - string description = 2; - - // Output only. The time when the metadata import was started. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import was last updated. - google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import finished. - google.protobuf.Timestamp end_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the metadata import. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata export operation. -message MetadataExport { - // The current state of the metadata export. - enum State { - // The state of the metadata export is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata export is running. - RUNNING = 1; - - // The metadata export completed successfully. - SUCCEEDED = 2; - - // The metadata export failed. - FAILED = 3; - - // The metadata export is cancelled. - CANCELLED = 4; - } - - oneof destination { - // Output only. A Cloud Storage URI of a folder that metadata are exported to, in the - // form of `gs:////`, where - // `` is automatically generated. - string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The time when the export started. - google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the export ended. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the export. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of the database dump. - DatabaseDumpSpec.Type database_dump_type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a backup resource. -message Backup { - option (google.api.resource) = { - type: "metastore.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" - }; - - // The current state of the backup. - enum State { - // The state of the backup is unknown. - STATE_UNSPECIFIED = 0; - - // The backup is being created. - CREATING = 1; - - // The backup is being deleted. - DELETING = 2; - - // The backup is active and ready to use. - ACTIVE = 3; - - // The backup failed. - FAILED = 4; - - // The backup is being restored. - RESTORING = 5; - } - - // Immutable. The relative resource name of the backup, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the backup was started. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup finished creating. - google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the service at the time of backup. - Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the backup. - string description = 6; - - // Output only. Services that are restoring from the backup. - repeated string restoring_services = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata restore operation. -message Restore { - // The current state of the restore. - enum State { - // The state of the metadata restore is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata restore is running. - RUNNING = 1; - - // The metadata restore completed successfully. - SUCCEEDED = 2; - - // The metadata restore failed. - FAILED = 3; - - // The metadata restore is cancelled. - CANCELLED = 4; - } - - // The type of restore. If unspecified, defaults to `METADATA_ONLY`. - enum RestoreType { - // The restore type is unknown. - RESTORE_TYPE_UNSPECIFIED = 0; - - // The service's metadata and configuration are restored. - FULL = 1; - - // Only the service's metadata is restored. - METADATA_ONLY = 2; - } - - // Output only. The time when the restore started. - google.protobuf.Timestamp start_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the restore ended. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the restore. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the metastore service backup to restore - // from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Output only. The type of restore. - RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The restore details containing the revision of the service to be restored - // to, in format of JSON. - string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. -message ListServicesRequest { - // Required. The relative resource name of the location of metastore services to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The maximum number of services to return. The response may contain less - // than the maximum number. If unspecified, no more than 500 services are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices]. -message ListServicesResponse { - // The services in the specified location. - repeated Service services = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for [DataprocMetastore.GetService][google.cloud.metastore.v1.DataprocMetastore.GetService]. -message GetServiceRequest { - // Required. The relative resource name of the metastore service to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Request message for [DataprocMetastore.CreateService][google.cloud.metastore.v1.DataprocMetastore.CreateService]. -message CreateServiceRequest { - // Required. The relative resource name of the location in which to create a metastore - // service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The ID of the metastore service, which is used as the final - // component of the metastore service's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string service_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore service to create. The `name` field is - // ignored. The ID of the created metastore service must be provided in - // the request's `service_id` field. - Service service = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.UpdateService][google.cloud.metastore.v1.DataprocMetastore.UpdateService]. -message UpdateServiceRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore service resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore service to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore service's `name` field is used to identify the metastore - // service to be updated. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.DeleteService][google.cloud.metastore.v1.DataprocMetastore.DeleteService]. -message DeleteServiceRequest { - // Required. The relative resource name of the metastore service to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsRequest { - // Required. The relative resource name of the service whose metadata imports to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Optional. The maximum number of imports to return. The response may contain less - // than the maximum number. If unspecified, no more than 500 imports are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices] must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsResponse { - // The imports in the specified service. - repeated MetadataImport metadata_imports = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport]. -message GetMetadataImportRequest { - // Required. The relative resource name of the metadata import to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/MetadataImport" - } - ]; -} - -// Request message for [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport]. -message CreateMetadataImportRequest { - // Required. The relative resource name of the service in which to create a metastore - // import, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Required. The ID of the metadata import, which is used as the final component of the - // metadata import's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to create. The `name` field is ignored. The ID of the - // created metadata import must be provided in the request's - // `metadata_import_id` field. - MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport]. -message UpdateMetadataImportRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metadata import resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to update. The server only merges fields - // in the import if they are specified in `update_mask`. - // - // The metadata import's `name` field is used to identify the metastore - // import to be updated. - MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. -message ListBackupsRequest { - // Required. The relative resource name of the service whose backups to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The maximum number of backups to return. The response may contain less - // than the maximum number. If unspecified, no more than 500 backups are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups] must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups]. -message ListBackupsResponse { - // The backups of the specified service. - repeated Backup backups = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for [DataprocMetastore.GetBackup][google.cloud.metastore.v1.DataprocMetastore.GetBackup]. -message GetBackupRequest { - // Required. The relative resource name of the backup to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; -} - -// Request message for [DataprocMetastore.CreateBackup][google.cloud.metastore.v1.DataprocMetastore.CreateBackup]. -message CreateBackupRequest { - // Required. The relative resource name of the service in which to create a backup - // of the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Required. The ID of the backup, which is used as the final component of the - // backup's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. The `name` field is ignored. The ID of the created - // backup must be provided in the request's `backup_id` field. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1.DataprocMetastore.DeleteBackup]. -message DeleteBackupRequest { - // Required. The relative resource name of the backup to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1.DataprocMetastore.ExportMetadata]. -message ExportMetadataRequest { - // Required. Destination that metadata is exported to. - oneof destination { - // A Cloud Storage URI of a folder, in the format - // `gs:///`. A sub-folder - // `` containing exported files will be created below it. - string destination_gcs_folder = 2; - } - - // Required. The relative resource name of the metastore service to run export, in the - // following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. - DatabaseDumpSpec.Type database_dump_type = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.Restore][]. -message RestoreServiceRequest { - // Required. The relative resource name of the metastore service to run restore, in the - // following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative resource name of the metastore service backup to restore - // from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the caller has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata about the service in a location. -message LocationMetadata { - // A specification of a supported version of the Hive Metastore software. - message HiveMetastoreVersion { - // The semantic version of the Hive Metastore software. - string version = 1; - - // Whether `version` will be chosen by the server if a metastore service is - // created with a `HiveMetastoreConfig` that omits the `version`. - bool is_default = 2; - } - - // The versions of Hive Metastore that can be used when creating a new - // metastore service in this location. The server guarantees that exactly one - // `HiveMetastoreVersion` in the list will set `is_default`. - repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; -} - -// The specification of database dump to import from or export to. -message DatabaseDumpSpec { - // The type of the database dump. - enum Type { - // The type of the database dump is unknown. - TYPE_UNSPECIFIED = 0; - - // Database dump is a MySQL dump file. - MYSQL = 1; - - // Database dump contains Avro files. - AVRO = 2; - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto deleted file mode 100644 index f3a95b1758d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/protos/google/cloud/metastore/v1/metastore_federation.proto +++ /dev/null @@ -1,361 +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.metastore.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1;metastore"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreFederationProto"; -option java_package = "com.google.cloud.metastore.v1"; - -// Configures and manages metastore federation services. -// Dataproc Metastore Federation Service allows federating a collection of -// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc -// Metastores. The Federation Service exposes a gRPC URL through which metadata -// from the backend metastores are served at query time. -// -// The Dataproc Metastore Federation API defines the following resource model: -// * The service works with a collection of Google Cloud projects. -// * Each project has a collection of available locations. -// * Each location has a collection of federations. -// * Dataproc Metastore Federations are resources with names of the -// form: -// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. -service DataprocMetastoreFederation { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists federations in a project and location. - rpc ListFederations(ListFederationsRequest) returns (ListFederationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/federations" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single federation. - rpc GetFederation(GetFederationRequest) returns (Federation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore federation in a project and location. - rpc CreateFederation(CreateFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/federations" - body: "federation" - }; - option (google.api.method_signature) = "parent,federation,federation_id"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Updates the fields of a federation. - rpc UpdateFederation(UpdateFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{federation.name=projects/*/locations/*/federations/*}" - body: "federation" - }; - option (google.api.method_signature) = "federation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } - - // Deletes a single federation. - rpc DeleteFederation(DeleteFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1.OperationMetadata" - }; - } -} - -// Represents a federation of multiple backend metastores. -message Federation { - option (google.api.resource) = { - type: "metastore.googleapis.com/Federation" - pattern: "projects/{project}/locations/{location}/federations/{federation}" - }; - - // The current state of the federation. - enum State { - // The state of the metastore federation is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore federation is in the process of being created. - CREATING = 1; - - // The metastore federation is running and ready to serve queries. - ACTIVE = 2; - - // The metastore federation is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 3; - - // The metastore federation is undergoing deletion. It cannot be used. - DELETING = 4; - - // The metastore federation has encountered an error and cannot be used. The - // metastore federation should be deleted. - ERROR = 5; - } - - // Immutable. The relative resource name of the federation, of the - // form: - // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore federation was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore federation was last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore federation. - map labels = 4; - - // Immutable. The Apache Hive metastore version of the federation. All backend metastore - // versions must be compatible with the federation version. - string version = 5 [(google.api.field_behavior) = IMMUTABLE]; - - // A map from `BackendMetastore` rank to `BackendMetastore`s from which the - // federation service serves metadata at query time. The map key represents - // the order in which `BackendMetastore`s should be evaluated to resolve - // database names at query time and should be greater than or equal to zero. A - // `BackendMetastore` with a lower number will be evaluated before a - // `BackendMetastore` with a higher number. - map backend_metastores = 6; - - // Output only. The federation endpoint. - string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the federation. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the metastore federation, - // if available. - string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The globally unique resource identifier of the metastore federation. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a backend metastore for the federation. -message BackendMetastore { - // The type of the backend metastore. - enum MetastoreType { - // The metastore type is not set. - METASTORE_TYPE_UNSPECIFIED = 0; - - // The backend metastore is Dataproc Metastore. - DATAPROC_METASTORE = 3; - } - - // The relative resource name of the metastore that is being federated. - // The formats of the relative resource names for the currently supported - // metastores are listed below: - // - // * Dataplex - // * `projects/{project_id}/locations/{location}/lakes/{lake_id}` - // * BigQuery - // * `projects/{project_id}` - // * Dataproc Metastore - // * `projects/{project_id}/locations/{location}/services/{service_id}` - string name = 1; - - // The type of the backend metastore. - MetastoreType metastore_type = 2; -} - -// Request message for ListFederations. -message ListFederationsRequest { - // Required. The relative resource name of the location of metastore federations - // to list, in the following form: - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. The maximum number of federations to return. The response may contain less - // than the maximum number. If unspecified, no more than 500 services are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous ListFederationServices - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // ListFederationServices must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListFederations -message ListFederationsResponse { - // The services in the specified location. - repeated Federation federations = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetFederation. -message GetFederationRequest { - // Required. The relative resource name of the metastore federation to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; -} - -// Request message for CreateFederation. -message CreateFederationRequest { - // Required. The relative resource name of the location in which to create a federation - // service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Required. The ID of the metastore federation, which is used as the final - // component of the metastore federation's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore Federation to create. The `name` field is - // ignored. The ID of the created metastore federation must be - // provided in the request's `federation_id` field. - Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for UpdateFederation. -message UpdateFederationRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore federation resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore federation to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore federation's `name` field is used to identify the - // metastore service to be updated. - Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for DeleteFederation. -message DeleteFederationRequest { - // Required. The relative resource name of the metastore federation to delete, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js deleted file mode 100644 index a1316624234..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_backup.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, backupId, backup) { - // [START metastore_v1_generated_DataprocMetastore_CreateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service in which to create a backup - * of the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. The `name` field is ignored. The ID of the created - * backup must be provided in the request's `backup_id` field. - */ - // const backup = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await metastoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END metastore_v1_generated_DataprocMetastore_CreateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js deleted file mode 100644 index 1f4be8c8ca9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_metadata_import.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, metadataImportId, metadataImport) { - // [START metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service in which to create a metastore - * import, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metadata import, which is used as the final component of the - * metadata import's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const metadataImportId = 'abc123' - /** - * Required. The metadata import to create. The `name` field is ignored. The ID of the - * created metadata import must be provided in the request's - * `metadata_import_id` field. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateMetadataImport() { - // Construct request - const request = { - parent, - metadataImportId, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.createMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMetadataImport(); - // [END metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js deleted file mode 100644 index be6cf3f7c6a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.create_service.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, serviceId, service) { - // [START metastore_v1_generated_DataprocMetastore_CreateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location in which to create a metastore - * service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const serviceId = 'abc123' - /** - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - serviceId, - service, - }; - - // Run request - const [operation] = await metastoreClient.createService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateService(); - // [END metastore_v1_generated_DataprocMetastore_CreateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js deleted file mode 100644 index fdf75b78ecc..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_backup.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastore_DeleteBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the backup to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END metastore_v1_generated_DataprocMetastore_DeleteBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js deleted file mode 100644 index 8316d5b3dd2..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.delete_service.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastore_DeleteService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteService(); - // [END metastore_v1_generated_DataprocMetastore_DeleteService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js deleted file mode 100644 index c1bbc957915..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.export_metadata.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(service) { - // [START metastore_v1_generated_DataprocMetastore_ExportMetadata_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - */ - // const destinationGcsFolder = 'abc123' - /** - * Required. The relative resource name of the metastore service to run export, in the - * following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - /** - * Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. - */ - // const databaseDumpType = {} - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callExportMetadata() { - // Construct request - const request = { - service, - }; - - // Run request - const [operation] = await metastoreClient.exportMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportMetadata(); - // [END metastore_v1_generated_DataprocMetastore_ExportMetadata_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js deleted file mode 100644 index ff95621e3f8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_backup.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastore_GetBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END metastore_v1_generated_DataprocMetastore_GetBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js deleted file mode 100644 index 8e1e2ea66a7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_metadata_import.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastore_GetMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metadata import to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetMetadataImport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getMetadataImport(request); - console.log(response); - } - - callGetMetadataImport(); - // [END metastore_v1_generated_DataprocMetastore_GetMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js deleted file mode 100644 index a2992042ab8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.get_service.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastore_GetService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getService(request); - console.log(response); - } - - callGetService(); - // [END metastore_v1_generated_DataprocMetastore_GetService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js deleted file mode 100644 index 3cdac068efb..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_backups.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1_generated_DataprocMetastore_ListBackups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of backups to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListBackups google.cloud.metastore.v1.DataprocMetastore.ListBackups must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END metastore_v1_generated_DataprocMetastore_ListBackups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js deleted file mode 100644 index 10bc22ba6ea..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_metadata_imports.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1_generated_DataprocMetastore_ListMetadataImports_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service whose metadata imports to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of imports to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListMetadataImports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listMetadataImportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetadataImports(); - // [END metastore_v1_generated_DataprocMetastore_ListMetadataImports_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js deleted file mode 100644 index 1d93595b5b5..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.list_services.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1_generated_DataprocMetastore_ListServices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location of metastore services to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of services to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1.DataprocMetastore.ListServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END metastore_v1_generated_DataprocMetastore_ListServices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js deleted file mode 100644 index ab5ae593c52..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.restore_service.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(service, backup) { - // [START metastore_v1_generated_DataprocMetastore_RestoreService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to run restore, in the - * following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative resource name of the metastore service backup to restore - * from, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const backup = 'abc123' - /** - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - */ - // const restoreType = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRestoreService() { - // Construct request - const request = { - service, - backup, - }; - - // Run request - const [operation] = await metastoreClient.restoreService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreService(); - // [END metastore_v1_generated_DataprocMetastore_RestoreService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js deleted file mode 100644 index 64d4a5dd7af..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_metadata_import.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, metadataImport) { - // [START metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateMetadataImport() { - // Construct request - const request = { - updateMask, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.updateMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMetadataImport(); - // [END metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js deleted file mode 100644 index 296a7604fd4..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore.update_service.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, service) { - // [START metastore_v1_generated_DataprocMetastore_UpdateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateService() { - // Construct request - const request = { - updateMask, - service, - }; - - // Run request - const [operation] = await metastoreClient.updateService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateService(); - // [END metastore_v1_generated_DataprocMetastore_UpdateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js deleted file mode 100644 index 0e7cd200044..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.create_federation.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, federationId, federation) { - // [START metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location in which to create a federation - * service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const federationId = 'abc123' - /** - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callCreateFederation() { - // Construct request - const request = { - parent, - federationId, - federation, - }; - - // Run request - const [operation] = await metastoreClient.createFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js deleted file mode 100644 index d1edfb692aa..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.delete_federation.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callDeleteFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js deleted file mode 100644 index e10d9d18c1c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.get_federation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore federation to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callGetFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getFederation(request); - console.log(response); - } - - callGetFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js deleted file mode 100644 index 86ffdaf90bd..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.list_federations.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callListFederations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listFederationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFederations(); - // [END metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js deleted file mode 100644 index 182b7f8d9e5..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/dataproc_metastore_federation.update_federation.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, federation) { - // [START metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callUpdateFederation() { - // Construct request - const request = { - updateMask, - federation, - }; - - // Run request - const [operation] = await metastoreClient.updateFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFederation(); - // [END metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json b/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json deleted file mode 100644 index 5d670b3b566..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/samples/generated/v1/snippet_metadata.google.cloud.metastore.v1.json +++ /dev/null @@ -1,987 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-metastore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.metastore.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ListServices_async", - "title": "DataprocMetastore listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists services in a project and location.", - "canonical": true, - "file": "dataproc_metastore.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListServicesResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListServices", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_GetService_async", - "title": "DataprocMetastore getService Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single service.", - "canonical": true, - "file": "dataproc_metastore.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.Service", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_CreateService_async", - "title": "DataprocMetastore createService Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore service in a project and location.", - "canonical": true, - "file": "dataproc_metastore.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateService_async", - "title": "DataprocMetastore updateService Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single service.", - "canonical": true, - "file": "dataproc_metastore.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteService_async", - "title": "DataprocMetastore deleteService Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single service.", - "canonical": true, - "file": "dataproc_metastore.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ListMetadataImports_async", - "title": "DataprocMetastore listMetadataImports Sample", - "origin": "API_DEFINITION", - "description": " Lists imports in a service.", - "canonical": true, - "file": "dataproc_metastore.list_metadata_imports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListMetadataImportsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_GetMetadataImport_async", - "title": "DataprocMetastore getMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single import.", - "canonical": true, - "file": "dataproc_metastore.get_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.MetadataImport", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async", - "title": "DataprocMetastore createMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Creates a new MetadataImport in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import_id", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async", - "title": "DataprocMetastore updateMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", - "canonical": true, - "file": "dataproc_metastore.update_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.UpdateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ExportMetadata_async", - "title": "DataprocMetastore exportMetadata Sample", - "origin": "API_DEFINITION", - "description": " Exports metadata from a service.", - "canonical": true, - "file": "dataproc_metastore.export_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", - "async": true, - "parameters": [ - { - "name": "destination_gcs_folder", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "database_dump_type", - "type": ".google.cloud.metastore.v1.DatabaseDumpSpec.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ExportMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_RestoreService_async", - "title": "DataprocMetastore restoreService Sample", - "origin": "API_DEFINITION", - "description": " Restores a service from a backup.", - "canonical": true, - "file": "dataproc_metastore.restore_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - }, - { - "name": "restore_type", - "type": ".google.cloud.metastore.v1.Restore.RestoreType" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.RestoreService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_ListBackups_async", - "title": "DataprocMetastore listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists backups in a service.", - "canonical": true, - "file": "dataproc_metastore.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListBackupsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.ListBackups", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_GetBackup_async", - "title": "DataprocMetastore getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single backup.", - "canonical": true, - "file": "dataproc_metastore.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.Backup", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.GetBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_CreateBackup_async", - "title": "DataprocMetastore createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.metastore.v1.Backup" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.CreateBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastore_DeleteBackup_async", - "title": "DataprocMetastore deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single backup.", - "canonical": true, - "file": "dataproc_metastore.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1.DataprocMetastore.DeleteBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async", - "title": "DataprocMetastore listFederations Sample", - "origin": "API_DEFINITION", - "description": " Lists federations in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.list_federations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.ListFederationsResponse", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.ListFederations", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async", - "title": "DataprocMetastore getFederation Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.get_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1.Federation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.GetFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async", - "title": "DataprocMetastore createFederation Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore federation in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.create_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "federation_id", - "type": "TYPE_STRING" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.CreateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async", - "title": "DataprocMetastore updateFederation Sample", - "origin": "API_DEFINITION", - "description": " Updates the fields of a federation.", - "canonical": true, - "file": "dataproc_metastore_federation.update_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.UpdateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async", - "title": "DataprocMetastore deleteFederation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.delete_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation.DeleteFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1.DataprocMetastoreFederation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/index.ts deleted file mode 100644 index 9a92fd523cf..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const DataprocMetastoreClient = v1.DataprocMetastoreClient; -type DataprocMetastoreClient = v1.DataprocMetastoreClient; -const DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; -type DataprocMetastoreFederationClient = v1.DataprocMetastoreFederationClient; -export {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -export default {v1, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts deleted file mode 100644 index 3aa11b4d2b7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client.ts +++ /dev/null @@ -1,3108 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/dataproc_metastore_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore services. - * Metastore services are fully managed, highly available, autoscaled, - * autohealing, OSS-native deployments of technical metadata management - * software. Each metastore service exposes a network endpoint through which - * metadata queries are served. Metadata queries can originate from a variety - * of sources, including Apache Hive, Apache Presto, and Apache Spark. - * - * The Dataproc Metastore API defines the following resource model: - * - * * The service works with a collection of Google Cloud projects, named: - * `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * (a location must refer to a Google Cloud `region`) - * * Each location has a collection of services, named: `/services/*` - * * Dataproc Metastore services are resources with names of the form: - * - * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @class - * @memberof v1 - */ -export class DataprocMetastoreClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DataprocMetastoreClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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 if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listMetadataImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; - const createServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const updateServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Service') as gax.protobuf.Type; - const updateServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const deleteServiceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const createMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; - const createMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const updateMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MetadataImport') as gax.protobuf.Type; - const updateMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const exportMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.MetadataExport') as gax.protobuf.Type; - const exportMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const restoreServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Restore') as gax.protobuf.Type; - const restoreServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServiceResponse.decode.bind(createServiceResponse), - createServiceMetadata.decode.bind(createServiceMetadata)), - updateService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServiceResponse.decode.bind(updateServiceResponse), - updateServiceMetadata.decode.bind(updateServiceMetadata)), - deleteService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServiceResponse.decode.bind(deleteServiceResponse), - deleteServiceMetadata.decode.bind(deleteServiceMetadata)), - createMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMetadataImportResponse.decode.bind(createMetadataImportResponse), - createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), - updateMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), - updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), - exportMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportMetadataResponse.decode.bind(exportMetadataResponse), - exportMetadataMetadata.decode.bind(exportMetadataMetadata)), - restoreService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreServiceResponse.decode.bind(restoreServiceResponse), - restoreServiceMetadata.decode.bind(restoreServiceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1.DataprocMetastore', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.dataprocMetastoreStub) { - return this.dataprocMetastoreStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1.DataprocMetastore. - this.dataprocMetastoreStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastore') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1.DataprocMetastore, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const dataprocMetastoreStubMethods = - ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup']; - for (const methodName of dataprocMetastoreStubMethods) { - const callPromise = this.dataprocMetastoreStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'metastore.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Service]{@link google.cloud.metastore.v1.Service}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.get_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_GetService_async - */ - getService( - request?: protos.google.cloud.metastore.v1.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.cloud.metastore.v1.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.cloud.metastore.v1.IGetServiceRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.cloud.metastore.v1.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IService, - protos.google.cloud.metastore.v1.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getService(request, options, callback); - } -/** - * Gets details of a single import. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metadata import to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.get_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_GetMetadataImport_async - */ - getMetadataImport( - request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|undefined, {}|undefined - ]>; - getMetadataImport( - request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request?: protos.google.cloud.metastore.v1.IGetMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport, - protos.google.cloud.metastore.v1.IGetMetadataImportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getMetadataImport(request, options, callback); - } -/** - * Gets details of a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.cloud.metastore.v1.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.get_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.metastore.v1.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.metastore.v1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.metastore.v1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.metastore.v1.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IBackup, - protos.google.cloud.metastore.v1.IGetBackupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBackup(request, options, callback); - } - -/** - * Creates a metastore service in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a metastore - * service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.serviceId - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1.Service} request.service - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async - */ - createService( - request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createService( - request: protos.google.cloud.metastore.v1.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.cloud.metastore.v1.ICreateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.cloud.metastore.v1.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateService_async - */ - async checkCreateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1.Service} request.service - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async - */ - updateService( - request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateService( - request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.cloud.metastore.v1.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateService_async - */ - async checkUpdateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async - */ - deleteService( - request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.cloud.metastore.v1.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteService_async - */ - async checkDeleteServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new MetadataImport in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a metastore - * import, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.metadataImportId - * Required. The ID of the metadata import, which is used as the final component of the - * metadata import's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport - * Required. The metadata import to create. The `name` field is ignored. The ID of the - * created metadata import must be provided in the request's - * `metadata_import_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async - */ - createMetadataImport( - request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMetadataImport( - request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request?: protos.google.cloud.metastore.v1.ICreateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateMetadataImport_async - */ - async checkCreateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single import. - * Only the description field of MetadataImport is supported to be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1.MetadataImport} request.metadataImport - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async - */ - updateMetadataImport( - request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMetadataImport( - request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request?: protos.google.cloud.metastore.v1.IUpdateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metadata_import.name': request.metadataImport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1_generated_DataprocMetastore_UpdateMetadataImport_async - */ - async checkUpdateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports metadata from a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.destinationGcsFolder - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run export, in the - * following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {google.cloud.metastore.v1.DatabaseDumpSpec.Type} [request.databaseDumpType] - * Optional. The type of the database dump. If unspecified, defaults to `MYSQL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async - */ - exportMetadata( - request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportMetadata( - request: protos.google.cloud.metastore.v1.IExportMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request: protos.google.cloud.metastore.v1.IExportMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request?: protos.google.cloud.metastore.v1.IExportMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1_generated_DataprocMetastore_ExportMetadata_async - */ - async checkExportMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a service from a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run restore, in the - * following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backup - * Required. The relative resource name of the metastore service backup to restore - * from, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {google.cloud.metastore.v1.Restore.RestoreType} [request.restoreType] - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.restore_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async - */ - restoreService( - request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreService( - request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request?: protos.google.cloud.metastore.v1.IRestoreServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.restore_service.js - * region_tag:metastore_v1_generated_DataprocMetastore_RestoreService_async - */ - async checkRestoreServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new backup in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a backup - * of the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backupId - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1.Backup} request.backup - * Required. The backup to create. The `name` field is ignored. The ID of the created - * backup must be provided in the request's `backup_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.metastore.v1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.metastore.v1.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.metastore.v1.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.create_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.metastore.v1.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1_generated_DataprocMetastore_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists services in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Service]{@link google.cloud.metastore.v1.Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listServices( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IService[], - protos.google.cloud.metastore.v1.IListServicesRequest|null, - protos.google.cloud.metastore.v1.IListServicesResponse - ]>; - listServices( - request: protos.google.cloud.metastore.v1.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>): void; - listServices( - request: protos.google.cloud.metastore.v1.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>): void; - listServices( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListServicesRequest, - protos.google.cloud.metastore.v1.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1.IService>): - Promise<[ - protos.google.cloud.metastore.v1.IService[], - protos.google.cloud.metastore.v1.IListServicesRequest|null, - protos.google.cloud.metastore.v1.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Service]{@link google.cloud.metastore.v1.Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listServicesStream( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Service]{@link google.cloud.metastore.v1.Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.list_services.js - * region_tag:metastore_v1_generated_DataprocMetastore_ListServices_async - */ - listServicesAsync( - request?: protos.google.cloud.metastore.v1.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists imports in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMetadataImports( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport[], - protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse - ]>; - listMetadataImports( - request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>): void; - listMetadataImports( - request: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>): void; - listMetadataImports( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1.IMetadataImport>): - Promise<[ - protos.google.cloud.metastore.v1.IMetadataImport[], - protos.google.cloud.metastore.v1.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1.IListMetadataImportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listMetadataImports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMetadataImportsStream( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.createStream( - this.innerApiCalls.listMetadataImports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetadataImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListServices|DataprocMetastore.ListServices} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [MetadataImport]{@link google.cloud.metastore.v1.MetadataImport}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.list_metadata_imports.js - * region_tag:metastore_v1_generated_DataprocMetastore_ListMetadataImports_async - */ - listMetadataImportsAsync( - request?: protos.google.cloud.metastore.v1.IListMetadataImportsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.asyncIterate( - this.innerApiCalls['listMetadataImports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists backups in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Backup]{@link google.cloud.metastore.v1.Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IBackup[], - protos.google.cloud.metastore.v1.IListBackupsRequest|null, - protos.google.cloud.metastore.v1.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.metastore.v1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>): void; - listBackups( - request: protos.google.cloud.metastore.v1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>): void; - listBackups( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListBackupsRequest, - protos.google.cloud.metastore.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1.IBackup>): - Promise<[ - protos.google.cloud.metastore.v1.IBackup[], - protos.google.cloud.metastore.v1.IListBackupsRequest|null, - protos.google.cloud.metastore.v1.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Backup]{@link google.cloud.metastore.v1.Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.cloud.metastore.v1.Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore.list_backups.js - * region_tag:metastore_v1_generated_DataprocMetastore_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.metastore.v1.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * 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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dataprocMetastoreStub && !this._terminated) { - return this.dataprocMetastoreStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json deleted file mode 100644 index 34a71622ee4..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_client_config.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1.DataprocMetastore": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListServices": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetService": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetadataImports": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts deleted file mode 100644 index 6fe2bcd5627..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client.ts +++ /dev/null @@ -1,1725 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/dataproc_metastore_federation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore federation services. - * Dataproc Metastore Federation Service allows federating a collection of - * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc - * Metastores. The Federation Service exposes a gRPC URL through which metadata - * from the backend metastores are served at query time. - * - * The Dataproc Metastore Federation API defines the following resource model: - * * The service works with a collection of Google Cloud projects. - * * Each project has a collection of available locations. - * * Each location has a collection of federations. - * * Dataproc Metastore Federations are resources with names of the - * form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @class - * @memberof v1 - */ -export class DataprocMetastoreFederationClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreFederationClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DataprocMetastoreFederationClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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 if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listFederations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; - const createFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const updateFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.Federation') as gax.protobuf.Type; - const updateFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - const deleteFederationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFederationResponse.decode.bind(createFederationResponse), - createFederationMetadata.decode.bind(createFederationMetadata)), - updateFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFederationResponse.decode.bind(updateFederationResponse), - updateFederationMetadata.decode.bind(updateFederationMetadata)), - deleteFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFederationResponse.decode.bind(deleteFederationResponse), - deleteFederationMetadata.decode.bind(deleteFederationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1.DataprocMetastoreFederation', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.dataprocMetastoreFederationStub) { - return this.dataprocMetastoreFederationStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1.DataprocMetastoreFederation. - this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1.DataprocMetastoreFederation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1.DataprocMetastoreFederation, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const dataprocMetastoreFederationStubMethods = - ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; - for (const methodName of dataprocMetastoreFederationStubMethods) { - const callPromise = this.dataprocMetastoreFederationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreFederationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'metastore.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Federation]{@link google.cloud.metastore.v1.Federation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.get_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_GetFederation_async - */ - getFederation( - request?: protos.google.cloud.metastore.v1.IGetFederationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|undefined, {}|undefined - ]>; - getFederation( - request: protos.google.cloud.metastore.v1.IGetFederationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request: protos.google.cloud.metastore.v1.IGetFederationRequest, - callback: Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request?: protos.google.cloud.metastore.v1.IGetFederationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1.IFederation, - protos.google.cloud.metastore.v1.IGetFederationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFederation(request, options, callback); - } - -/** - * Creates a metastore federation in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a federation - * service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.federationId - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1.Federation} request.federation - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async - */ - createFederation( - request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFederation( - request: protos.google.cloud.metastore.v1.ICreateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request: protos.google.cloud.metastore.v1.ICreateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request?: protos.google.cloud.metastore.v1.ICreateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_CreateFederation_async - */ - async checkCreateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the fields of a federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1.Federation} request.federation - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - updateFederation( - request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFederation( - request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request?: protos.google.cloud.metastore.v1.IUpdateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'federation.name': request.federation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - async checkUpdateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - deleteFederation( - request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFederation( - request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request?: protos.google.cloud.metastore.v1.IDeleteFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - async checkDeleteFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists federations in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Federation]{@link google.cloud.metastore.v1.Federation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFederations( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1.IFederation[], - protos.google.cloud.metastore.v1.IListFederationsRequest|null, - protos.google.cloud.metastore.v1.IListFederationsResponse - ]>; - listFederations( - request: protos.google.cloud.metastore.v1.IListFederationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>): void; - listFederations( - request: protos.google.cloud.metastore.v1.IListFederationsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>): void; - listFederations( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1.IListFederationsRequest, - protos.google.cloud.metastore.v1.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1.IFederation>): - Promise<[ - protos.google.cloud.metastore.v1.IFederation[], - protos.google.cloud.metastore.v1.IListFederationsRequest|null, - protos.google.cloud.metastore.v1.IListFederationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFederations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Federation]{@link google.cloud.metastore.v1.Federation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFederationsStream( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.createStream( - this.innerApiCalls.listFederations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFederations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Federation]{@link google.cloud.metastore.v1.Federation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/dataproc_metastore_federation.list_federations.js - * region_tag:metastore_v1_generated_DataprocMetastoreFederation_ListFederations_async - */ - listFederationsAsync( - request?: protos.google.cloud.metastore.v1.IListFederationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.asyncIterate( - this.innerApiCalls['listFederations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * 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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dataprocMetastoreFederationStub && !this._terminated) { - return this.dataprocMetastoreFederationStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json deleted file mode 100644 index 71c66a13e4c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1.DataprocMetastoreFederation": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListFederations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json deleted file mode 100644 index 76860a15e6b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_federation_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1/metastore.proto", - "../../protos/google/cloud/metastore/v1/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json deleted file mode 100644 index 76860a15e6b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/dataproc_metastore_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1/metastore.proto", - "../../protos/google/cloud/metastore/v1/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 0e5fffd2771..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.metastore.v1", - "libraryPackage": "@google-cloud/dataproc-metastore", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "DataprocMetastoreFederation": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts deleted file mode 100644 index 3e1ee876b29..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/src/v1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {DataprocMetastoreClient} from './dataproc_metastore_client'; -export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 74e7a6657af..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const metastore = require('@google-cloud/dataproc-metastore'); - -function main() { - const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); - const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index f10cef1cd2c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; - -// check that the client class type name can be used -function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { - client.close(); -} -function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dataprocMetastoreClient = new DataprocMetastoreClient(); - doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); - // check that the client instance can be created - const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); - doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts deleted file mode 100644 index e97240ab9b9..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_federation_v1.ts +++ /dev/null @@ -1,2000 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dataprocmetastorefederationModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DataprocMetastoreFederationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreFederationStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreFederationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getFederation', () => { - it('invokes getFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); - const [response] = await client.getFederation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFederation( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with closed client', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFederation(request), expectedError); - }); - }); - - describe('createFederation', () => { - it('invokes createFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFederation', () => { - it('invokes updateFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFederation', () => { - it('invokes deleteFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFederations', () => { - it('invokes listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); - const [response] = await client.listFederations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFederations( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IFederation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFederations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederationsStream without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFederationsStream with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Federation()), - ]; - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IFederation[] = []; - const iterable = client.listFederationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFederationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IFederation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastorefederationModule.v1.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts b/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts deleted file mode 100644 index 91ddbfd4506..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/test/gapic_dataproc_metastore_v1.ts +++ /dev/null @@ -1,3672 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dataprocmetastoreModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DataprocMetastoreClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastoreModule.v1.DataprocMetastoreClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastoreModule.v1.DataprocMetastoreClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastoreModule.v1.DataprocMetastoreClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getService', () => { - it('invokes getService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('getMetadataImport', () => { - it('invokes getMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); - const [response] = await client.getMetadataImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetadataImport( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with closed client', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMetadataImport(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); - const [operation] = await client.createService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createMetadataImport', () => { - it('invokes createMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMetadataImport', () => { - it('invokes updateMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportMetadata', () => { - it('invokes exportMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreService', () => { - it('invokes restoreService without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreService(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRestoreServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetadataImports', () => { - it('invokes listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); - const [response] = await client.listMetadataImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetadataImports( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IMetadataImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetadataImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImportsStream without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetadataImportsStream with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; - const iterable = client.listMetadataImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetadataImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IMetadataImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastoreModule.v1.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js deleted file mode 100644 index 6fc45cb3d30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DataprocMetastore', - filename: './dataproc-metastore.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore b/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js deleted file mode 100644 index bc8b6fc164f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dataproc-metastore', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/README.md b/owl-bot-staging/google-cloud-metastore/v1alpha/README.md deleted file mode 100644 index 24afb9017c6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/package.json b/owl-bot-staging/google-cloud-metastore/v1alpha/package.json deleted file mode 100644 index b3e0a6424ad..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/dataproc-metastore", - "version": "0.1.0", - "description": "Metastore client for Node.js", - "repository": "googleapis/nodejs-metastore", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google metastore", - "metastore", - "dataproc metastore", - "dataproc metastore federation" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto deleted file mode 100644 index 3cac5b5abc7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore.proto +++ /dev/null @@ -1,1462 +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.metastore.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/dayofweek.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha;metastore"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreProto"; -option java_package = "com.google.cloud.metastore.v1alpha"; -option php_namespace = "Google\\Cloud\\Metastore\\V1alpha"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Subnetwork" - pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" -}; -option (google.api.resource_definition) = { - type: "dataplex.googleapis.com/Lake" - pattern: "projects/{project}/locations/{location}/lakes/{lake}" -}; - -// Configures and manages metastore services. -// Metastore services are fully managed, highly available, autoscaled, -// autohealing, OSS-native deployments of technical metadata management -// software. Each metastore service exposes a network endpoint through which -// metadata queries are served. Metadata queries can originate from a variety -// of sources, including Apache Hive, Apache Presto, and Apache Spark. -// -// The Dataproc Metastore API defines the following resource model: -// -// * The service works with a collection of Google Cloud projects, named: -// `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// (a location must refer to a Google Cloud `region`) -// * Each location has a collection of services, named: `/services/*` -// * Dataproc Metastore services are resources with names of the form: -// -// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. -service DataprocMetastore { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists services in a project and location. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single service. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore service in a project and location. - rpc CreateService(CreateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service,service_id"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Updates the parameters of a single service. - rpc UpdateService(UpdateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{service.name=projects/*/locations/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Deletes a single service. - rpc DeleteService(DeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Lists imports in a service. - rpc ListMetadataImports(ListMetadataImportsRequest) - returns (ListMetadataImportsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single import. - rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/services/*/metadataImports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new MetadataImport in a given project and location. - rpc CreateMetadataImport(CreateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*/services/*}/metadataImports" - body: "metadata_import" - }; - option (google.api.method_signature) = - "parent,metadata_import,metadata_import_id"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Updates a single import. - // Only the description field of MetadataImport is supported to be updated. - rpc UpdateMetadataImport(UpdateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" - body: "metadata_import" - }; - option (google.api.method_signature) = "metadata_import,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Exports metadata from a service. - rpc ExportMetadata(ExportMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:exportMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MetadataExport" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Restores a service from a backup. - rpc RestoreService(RestoreServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{service=projects/*/locations/*/services/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "service,backup"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Lists backups in a service. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new backup in a given project and location. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*/services/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Deletes a single backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } -} - -// A managed metastore service that serves metadata queries. -message Service { - option (google.api.resource) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" - }; - - // The current state of the metastore service. - enum State { - // The state of the metastore service is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore service is in the process of being created. - CREATING = 1; - - // The metastore service is running and ready to serve queries. - ACTIVE = 2; - - // The metastore service is entering suspension. Its query-serving - // availability may cease unexpectedly. - SUSPENDING = 3; - - // The metastore service is suspended and unable to serve queries. - SUSPENDED = 4; - - // The metastore service is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 5; - - // The metastore service is undergoing deletion. It cannot be used. - DELETING = 6; - - // The metastore service has encountered an error and cannot be used. The - // metastore service should be deleted. - ERROR = 7; - } - - // Available service tiers. - enum Tier { - // The tier is not set. - TIER_UNSPECIFIED = 0; - - // The developer tier provides limited scalability and no fault tolerance. - // Good for low-cost proof-of-concept. - DEVELOPER = 1; - - // The enterprise tier provides multi-zone high availability, and sufficient - // scalability for enterprise-level Dataproc Metastore workloads. - ENTERPRISE = 3; - } - - // Release channels bundle features of varying levels of stability. Newer - // features may be introduced initially into less stable release channels and - // can be automatically promoted into more stable release channels. - enum ReleaseChannel { - // Release channel is not specified. - RELEASE_CHANNEL_UNSPECIFIED = 0; - - // The `CANARY` release channel contains the newest features, which may be - // unstable and subject to unresolved issues with no known workarounds. - // Services using the `CANARY` release channel are not subject to any SLAs. - CANARY = 1; - - // The `STABLE` release channel contains features that are considered stable - // and have been validated for production use. - STABLE = 2; - } - - // The backend database type for the metastore service. - enum DatabaseType { - // The DATABASE_TYPE is not set. - DATABASE_TYPE_UNSPECIFIED = 0; - - // MySQL is used to persist the metastore data. - MYSQL = 1; - - // Spanner is used to persist the metastore data. - SPANNER = 2; - } - - // Configuration properties specific to the underlying metastore service - // technology (the software that serves metastore queries). - oneof metastore_config { - // Configuration information specific to running Hive metastore - // software as the metastore service. - HiveMetastoreConfig hive_metastore_config = 5; - } - - // Immutable. The relative resource name of the metastore service, in the - // following format: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore service was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore service was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore service. - map labels = 4; - - // Immutable. The relative resource name of the VPC network on which the - // instance can be accessed. It is specified in the following form: - // - // `projects/{project_number}/global/networks/{network_id}`. - string network = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The TCP port at which the metastore service is reached. Default: 9083. - int32 port = 9; - - // Output only. The current state of the metastore service. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore service, if available. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A Cloud Storage URI (starting with `gs://`) that specifies - // where artifacts related to the metastore service are stored. - string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The tier of the service. - Tier tier = 13; - - // The setting that defines how metastore metadata should be integrated with - // external services and systems. - MetadataIntegration metadata_integration = 14; - - // The one hour maintenance window of the metastore service. This specifies - // when the service can be restarted for maintenance purposes in UTC time. - // Maintenance window is not needed for services with the SPANNER - // database type. - MaintenanceWindow maintenance_window = 15; - - // Output only. The globally unique resource identifier of the metastore - // service. - string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The metadata management activities of the metastore service. - MetadataManagementActivity metadata_management_activity = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The release channel of the service. - // If unspecified, defaults to `STABLE`. - ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Information used to configure the Dataproc Metastore service to - // encrypt customer data at rest. Cannot be updated. - EncryptionConfig encryption_config = 20 - [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying the network settings for the - // Dataproc Metastore service. - NetworkConfig network_config = 21; - - // Immutable. The database type that the Metastore service stores its data. - DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying telemetry settings for the Dataproc Metastore - // service. If unspecified defaults to `JSON`. - TelemetryConfig telemetry_config = 23; -} - -// Specifies how metastore metadata should be integrated with external services. -message MetadataIntegration { - // The integration config for the Data Catalog service. - DataCatalogConfig data_catalog_config = 1; - - // The integration config for the Dataplex service. - DataplexConfig dataplex_config = 2; -} - -// Specifies how metastore metadata should be integrated with the Data Catalog -// service. -message DataCatalogConfig { - // Defines whether the metastore metadata should be synced to Data Catalog. - // The default value is to disable syncing metastore metadata to Data Catalog. - bool enabled = 2; -} - -// Specifies how metastore metadata should be integrated with the Dataplex -// service. -message DataplexConfig { - // A reference to the Lake resources that this metastore service is attached - // to. The key is the lake resource name. Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. - map lake_resources = 1; -} - -// Represents a Lake resource -message Lake { - // The Lake resource name. - // Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` - string name = 1 [ - (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } - ]; -} - -// Maintenance window. This specifies when Dataproc Metastore -// may perform system maintenance operation to the service. -message MaintenanceWindow { - // The hour of day (0-23) when the window starts. - google.protobuf.Int32Value hour_of_day = 1; - - // The day of week, when the window starts. - google.type.DayOfWeek day_of_week = 2; -} - -// Specifies configuration information specific to running Hive metastore -// software as the metastore service. -message HiveMetastoreConfig { - // Protocols available for serving the metastore service endpoint. - enum EndpointProtocol { - // The protocol is not set. - ENDPOINT_PROTOCOL_UNSPECIFIED = 0; - - // Use the legacy Apache Thrift protocol for the metastore service endpoint. - THRIFT = 1; - - // Use the modernized gRPC protocol for the metastore service endpoint. - GRPC = 2; - } - - // Immutable. The Hive metastore schema version. - string version = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // Hive metastore (configured in `hive-site.xml`). The mappings - // override system defaults (some keys cannot be overridden). These - // overrides are also applied to auxiliary versions and can be further - // customized in the auxiliary version's `AuxiliaryVersionConfig`. - map config_overrides = 2; - - // Information used to configure the Hive metastore service as a service - // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` - // method and specify this field's path - // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` - // while omitting this field from the request's `service`. - KerberosConfig kerberos_config = 3; - - // The protocol to use for the metastore service endpoint. If unspecified, - // defaults to `THRIFT`. - EndpointProtocol endpoint_protocol = 4; - - // A mapping of Hive metastore version to the auxiliary version - // configuration. When specified, a secondary Hive metastore service is - // created along with the primary service. All auxiliary versions must be less - // than the service's primary version. The key is the auxiliary service name - // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This - // means that the first character must be a lowercase letter, and all the - // following characters must be hyphens, lowercase letters, or digits, except - // the last character, which cannot be a hyphen. - map auxiliary_versions = 5; -} - -// Configuration information for a Kerberos principal. -message KerberosConfig { - // A Kerberos keytab file that can be used to authenticate a service principal - // with a Kerberos Key Distribution Center (KDC). - Secret keytab = 1; - - // A Kerberos principal that exists in the both the keytab the KDC - // to authenticate as. A typical principal is of the form - // `primary/instance@REALM`, but there is no exact format. - string principal = 2; - - // A Cloud Storage URI that specifies the path to a - // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, - // although the file does not need to be named krb5.conf explicitly. - string krb5_config_gcs_uri = 3; -} - -// A securely stored value. -message Secret { - oneof value { - // The relative resource name of a Secret Manager secret version, in the - // following form: - // - // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. - string cloud_secret = 2; - } -} - -// Encryption settings for the service. -message EncryptionConfig { - // The fully qualified customer provided Cloud KMS key name to use for - // customer data encryption, in the following form: - // - // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. - string kms_key = 1; -} - -// Configuration information for the auxiliary service versions. -message AuxiliaryVersionConfig { - // The Hive metastore version of the auxiliary service. It must be less - // than the primary Hive metastore service's version. - string version = 1; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to - // the primary version's overrides. If keys are present in both the auxiliary - // version's overrides and the primary version's overrides, the value from - // the auxiliary version's overrides takes precedence. - map config_overrides = 2; - - // Output only. The network configuration contains the endpoint URI(s) of the - // auxiliary Hive metastore service. - NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Network configuration for the Dataproc Metastore service. -message NetworkConfig { - // Contains information of the customer's network configurations. - message Consumer { - oneof vpc_resource { - // Immutable. The subnetwork of the customer project from which an IP - // address is reserved and used as the Dataproc Metastore service's - // endpoint. It is accessible to hosts in the subnet and to all - // hosts in a subnet in the same region and same network. There must - // be at least one IP address available in the subnet's primary range. The - // subnet is specified in the following form: - // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id} - string subnetwork = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Subnetwork" - } - ]; - } - - // Output only. The URI of the endpoint used to access the metastore - // service. - string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Immutable. The consumer-side network configuration for the Dataproc - // Metastore instance. - repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; -} - -// Telemetry Configuration for the Dataproc Metastore service. -message TelemetryConfig { - enum LogFormat { - // The LOG_FORMAT is not set. - LOG_FORMAT_UNSPECIFIED = 0; - - // Logging output uses the legacy `textPayload` format. - LEGACY = 1; - - // Logging output uses the `jsonPayload` format. - JSON = 2; - } - - // The output format of the Dataproc Metastore service's logs. - LogFormat log_format = 1; -} - -// The metadata management activities of the metastore service. -message MetadataManagementActivity { - // Output only. The latest metadata exports of the metastore service. - repeated MetadataExport metadata_exports = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The latest restores of the metastore service. - repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A metastore resource that imports metadata. -message MetadataImport { - option (google.api.resource) = { - type: "metastore.googleapis.com/MetadataImport" - pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" - }; - - // A specification of the location of and metadata about a database dump from - // a relational database management system. - message DatabaseDump { - // The type of the database. - enum DatabaseType { - // The type of the source database is unknown. - DATABASE_TYPE_UNSPECIFIED = 0; - - // The type of the source database is MySQL. - MYSQL = 1; - } - - // The type of the database. - DatabaseType database_type = 1 [deprecated = true]; - - // A Cloud Storage object or folder URI that specifies the source from which - // to import metadata. It must begin with `gs://`. - string gcs_uri = 2; - - // The name of the source database. - string source_database = 3 [deprecated = true]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The current state of the metadata import. - enum State { - // The state of the metadata import is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata import is running. - RUNNING = 1; - - // The metadata import completed successfully. - SUCCEEDED = 2; - - // The metadata import is being updated. - UPDATING = 3; - - // The metadata import failed, and attempted metadata changes were rolled - // back. - FAILED = 4; - } - - // The metadata to be imported. - oneof metadata { - // Immutable. A database dump from a pre-existing metastore's database. - DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Immutable. The relative resource name of the metadata import, of the form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The description of the metadata import. - string description = 2; - - // Output only. The time when the metadata import was started. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import finished. - google.protobuf.Timestamp end_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the metadata import. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata export operation. -message MetadataExport { - // The current state of the metadata export. - enum State { - // The state of the metadata export is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata export is running. - RUNNING = 1; - - // The metadata export completed successfully. - SUCCEEDED = 2; - - // The metadata export failed. - FAILED = 3; - - // The metadata export is cancelled. - CANCELLED = 4; - } - - oneof destination { - // Output only. A Cloud Storage URI of a folder that metadata are exported - // to, in the form of - // `gs:////`, where - // `` is automatically generated. - string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The time when the export started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the export ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the export. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of the database dump. - DatabaseDumpSpec.Type database_dump_type = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a backup resource. -message Backup { - option (google.api.resource) = { - type: "metastore.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" - }; - - // The current state of the backup. - enum State { - // The state of the backup is unknown. - STATE_UNSPECIFIED = 0; - - // The backup is being created. - CREATING = 1; - - // The backup is being deleted. - DELETING = 2; - - // The backup is active and ready to use. - ACTIVE = 3; - - // The backup failed. - FAILED = 4; - - // The backup is being restored. - RESTORING = 5; - } - - // Immutable. The relative resource name of the backup, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the backup was started. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup finished creating. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the service at the time of backup. - Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the backup. - string description = 6; - - // Output only. Services that are restoring from the backup. - repeated string restoring_services = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata restore operation. -message Restore { - // The current state of the restore. - enum State { - // The state of the metadata restore is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata restore is running. - RUNNING = 1; - - // The metadata restore completed successfully. - SUCCEEDED = 2; - - // The metadata restore failed. - FAILED = 3; - - // The metadata restore is cancelled. - CANCELLED = 4; - } - - // The type of restore. If unspecified, defaults to `METADATA_ONLY`. - enum RestoreType { - // The restore type is unknown. - RESTORE_TYPE_UNSPECIFIED = 0; - - // The service's metadata and configuration are restored. - FULL = 1; - - // Only the service's metadata is restored. - METADATA_ONLY = 2; - } - - // Output only. The time when the restore started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the restore ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the restore. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Output only. The type of restore. - RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The restore details containing the revision of the service to - // be restored to, in format of JSON. - string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. -message ListServicesRequest { - // Required. The relative resource name of the location of metastore services - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The maximum number of services to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices]. -message ListServicesResponse { - // The services in the specified location. - repeated Service services = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetService][google.cloud.metastore.v1alpha.DataprocMetastore.GetService]. -message GetServiceRequest { - // Required. The relative resource name of the metastore service to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateService][google.cloud.metastore.v1alpha.DataprocMetastore.CreateService]. -message CreateServiceRequest { - // Required. The relative resource name of the location in which to create a - // metastore service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The ID of the metastore service, which is used as the final - // component of the metastore service's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string service_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore service to create. The `name` field is - // ignored. The ID of the created metastore service must be provided in - // the request's `service_id` field. - Service service = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateService][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService]. -message UpdateServiceRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore service resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore service to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore service's `name` field is used to identify the metastore - // service to be updated. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteService][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService]. -message DeleteServiceRequest { - // Required. The relative resource name of the metastore service to delete, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsRequest { - // Required. The relative resource name of the service whose metadata imports - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Optional. The maximum number of imports to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 imports are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1alpha.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsResponse { - // The imports in the specified service. - repeated MetadataImport metadata_imports = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport]. -message GetMetadataImportRequest { - // Required. The relative resource name of the metadata import to retrieve, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/MetadataImport" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport]. -message CreateMetadataImportRequest { - // Required. The relative resource name of the service in which to create a - // metastore import, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Required. The ID of the metadata import, which is used as the final - // component of the metadata import's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to create. The `name` field is ignored. The - // ID of the created metadata import must be provided in the request's - // `metadata_import_id` field. - MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport]. -message UpdateMetadataImportRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metadata import resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to update. The server only merges fields - // in the import if they are specified in `update_mask`. - // - // The metadata import's `name` field is used to identify the metastore - // import to be updated. - MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. -message ListBackupsRequest { - // Required. The relative resource name of the service whose backups to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The maximum number of backups to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 backups are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups]. -message ListBackupsResponse { - // The backups of the specified service. - repeated Backup backups = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetBackup][google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup]. -message GetBackupRequest { - // Required. The relative resource name of the backup to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup]. -message CreateBackupRequest { - // Required. The relative resource name of the service in which to create a - // backup of the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Required. The ID of the backup, which is used as the final component of the - // backup's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. The `name` field is ignored. The ID of the - // created backup must be provided in the request's `backup_id` field. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup]. -message DeleteBackupRequest { - // Required. The relative resource name of the backup to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata]. -message ExportMetadataRequest { - // Required. Destination that metadata is exported to. - oneof destination { - // A Cloud Storage URI of a folder, in the format - // `gs:///`. A sub-folder - // `` containing exported files will be created below it. - string destination_gcs_folder = 2; - } - - // Required. The relative resource name of the metastore service to run - // export, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type database_dump_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.Restore][]. -message RestoreServiceRequest { - // Required. The relative resource name of the metastore service to run - // restore, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the caller has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata about the service in a location. -message LocationMetadata { - // A specification of a supported version of the Hive Metastore software. - message HiveMetastoreVersion { - // The semantic version of the Hive Metastore software. - string version = 1; - - // Whether `version` will be chosen by the server if a metastore service is - // created with a `HiveMetastoreConfig` that omits the `version`. - bool is_default = 2; - } - - // The versions of Hive Metastore that can be used when creating a new - // metastore service in this location. The server guarantees that exactly one - // `HiveMetastoreVersion` in the list will set `is_default`. - repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; -} - -// The specification of database dump to import from or export to. -message DatabaseDumpSpec { - // The type of the database dump. - enum Type { - // The type of the database dump is unknown. - TYPE_UNSPECIFIED = 0; - - // Database dump is a MySQL dump file. - MYSQL = 1; - - // Database dump contains Avro files. - AVRO = 2; - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto deleted file mode 100644 index d4f07335455..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/protos/google/cloud/metastore/v1alpha/metastore_federation.proto +++ /dev/null @@ -1,364 +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.metastore.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha;metastore"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreFederationProto"; -option java_package = "com.google.cloud.metastore.v1alpha"; - -// Configures and manages metastore federation services. -// Dataproc Metastore Federation Service allows federating a collection of -// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc -// Metastores. The Federation Service exposes a gRPC URL through which metadata -// from the backend metastores are served at query time. -// -// The Dataproc Metastore Federation API defines the following resource model: -// * The service works with a collection of Google Cloud projects. -// * Each project has a collection of available locations. -// * Each location has a collection of federations. -// * Dataproc Metastore Federations are resources with names of the -// form: -// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. -service DataprocMetastoreFederation { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists federations in a project and location. - rpc ListFederations(ListFederationsRequest) returns (ListFederationsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/locations/*}/federations" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single federation. - rpc GetFederation(GetFederationRequest) returns (Federation) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore federation in a project and location. - rpc CreateFederation(CreateFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*/locations/*}/federations" - body: "federation" - }; - option (google.api.method_signature) = "parent,federation,federation_id"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Updates the fields of a federation. - rpc UpdateFederation(UpdateFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha/{federation.name=projects/*/locations/*/federations/*}" - body: "federation" - }; - option (google.api.method_signature) = "federation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } - - // Deletes a single federation. - rpc DeleteFederation(DeleteFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1alpha.OperationMetadata" - }; - } -} - -// Represents a federation of multiple backend metastores. -message Federation { - option (google.api.resource) = { - type: "metastore.googleapis.com/Federation" - pattern: "projects/{project}/locations/{location}/federations/{federation}" - }; - - // The current state of the federation. - enum State { - // The state of the metastore federation is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore federation is in the process of being created. - CREATING = 1; - - // The metastore federation is running and ready to serve queries. - ACTIVE = 2; - - // The metastore federation is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 3; - - // The metastore federation is undergoing deletion. It cannot be used. - DELETING = 4; - - // The metastore federation has encountered an error and cannot be used. The - // metastore federation should be deleted. - ERROR = 5; - } - - // Immutable. The relative resource name of the federation, of the - // form: - // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore federation was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore federation was last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore federation. - map labels = 4; - - // Immutable. The Apache Hive metastore version of the federation. All backend metastore - // versions must be compatible with the federation version. - string version = 5 [(google.api.field_behavior) = IMMUTABLE]; - - // A map from `BackendMetastore` rank to `BackendMetastore`s from which the - // federation service serves metadata at query time. The map key represents - // the order in which `BackendMetastore`s should be evaluated to resolve - // database names at query time and should be greater than or equal to zero. A - // `BackendMetastore` with a lower number will be evaluated before a - // `BackendMetastore` with a higher number. - map backend_metastores = 6; - - // Output only. The federation endpoint. - string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the federation. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the metastore federation, - // if available. - string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The globally unique resource identifier of the metastore federation. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a backend metastore for the federation. -message BackendMetastore { - // The type of the backend metastore. - enum MetastoreType { - // The metastore type is not set. - METASTORE_TYPE_UNSPECIFIED = 0; - - // The backend metastore is BigQuery. - BIGQUERY = 2; - - // The backend metastore is Dataproc Metastore. - DATAPROC_METASTORE = 3; - } - - // The relative resource name of the metastore that is being federated. - // The formats of the relative resource names for the currently supported - // metastores are listed below: - // - // * Dataplex - // * `projects/{project_id}/locations/{location}/lakes/{lake_id}` - // * BigQuery - // * `projects/{project_id}` - // * Dataproc Metastore - // * `projects/{project_id}/locations/{location}/services/{service_id}` - string name = 1; - - // The type of the backend metastore. - MetastoreType metastore_type = 2; -} - -// Request message for ListFederations. -message ListFederationsRequest { - // Required. The relative resource name of the location of metastore federations - // to list, in the following form: - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. The maximum number of federations to return. The response may contain less - // than the maximum number. If unspecified, no more than 500 services are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous ListFederationServices - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // ListFederationServices must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListFederations -message ListFederationsResponse { - // The services in the specified location. - repeated Federation federations = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetFederation. -message GetFederationRequest { - // Required. The relative resource name of the metastore federation to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; -} - -// Request message for CreateFederation. -message CreateFederationRequest { - // Required. The relative resource name of the location in which to create a federation - // service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Required. The ID of the metastore federation, which is used as the final - // component of the metastore federation's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore Federation to create. The `name` field is - // ignored. The ID of the created metastore federation must be - // provided in the request's `federation_id` field. - Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for UpdateFederation. -message UpdateFederationRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore federation resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore federation to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore federation's `name` field is used to identify the - // metastore service to be updated. - Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for DeleteFederation. -message DeleteFederationRequest { - // Required. The relative resource name of the metastore federation to delete, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js deleted file mode 100644 index 46f14e978db..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_backup.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, backupId, backup) { - // [START metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - */ - // const backup = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await metastoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js deleted file mode 100644 index 160570c1d9b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, metadataImportId, metadataImport) { - // [START metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const metadataImportId = 'abc123' - /** - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateMetadataImport() { - // Construct request - const request = { - parent, - metadataImportId, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.createMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMetadataImport(); - // [END metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js deleted file mode 100644 index 1a2911e08ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.create_service.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, serviceId, service) { - // [START metastore_v1alpha_generated_DataprocMetastore_CreateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const serviceId = 'abc123' - /** - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - serviceId, - service, - }; - - // Run request - const [operation] = await metastoreClient.createService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateService(); - // [END metastore_v1alpha_generated_DataprocMetastore_CreateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js deleted file mode 100644 index e51c754d667..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_backup.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the backup to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js deleted file mode 100644 index aafdab8ffc7..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.delete_service.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_DeleteService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteService(); - // [END metastore_v1alpha_generated_DataprocMetastore_DeleteService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js deleted file mode 100644 index b8acec0f0a1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.export_metadata.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(service) { - // [START metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - */ - // const destinationGcsFolder = 'abc123' - /** - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - /** - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - */ - // const databaseDumpType = {} - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callExportMetadata() { - // Construct request - const request = { - service, - }; - - // Run request - const [operation] = await metastoreClient.exportMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportMetadata(); - // [END metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js deleted file mode 100644 index 71242ecb098..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_backup.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_GetBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END metastore_v1alpha_generated_DataprocMetastore_GetBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js deleted file mode 100644 index 25803bf327b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetMetadataImport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getMetadataImport(request); - console.log(response); - } - - callGetMetadataImport(); - // [END metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js deleted file mode 100644 index 863a6663f63..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.get_service.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastore_GetService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getService(request); - console.log(response); - } - - callGetService(); - // [END metastore_v1alpha_generated_DataprocMetastore_GetService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js deleted file mode 100644 index c78b7a873ce..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_backups.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1alpha_generated_DataprocMetastore_ListBackups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListBackups google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END metastore_v1alpha_generated_DataprocMetastore_ListBackups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js deleted file mode 100644 index 5f22941d095..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListMetadataImports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listMetadataImportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetadataImports(); - // [END metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js deleted file mode 100644 index 904a272387f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.list_services.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1alpha_generated_DataprocMetastore_ListServices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1alpha.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END metastore_v1alpha_generated_DataprocMetastore_ListServices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js deleted file mode 100644 index 5efc4842573..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.restore_service.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(service, backup) { - // [START metastore_v1alpha_generated_DataprocMetastore_RestoreService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const backup = 'abc123' - /** - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - */ - // const restoreType = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRestoreService() { - // Construct request - const request = { - service, - backup, - }; - - // Run request - const [operation] = await metastoreClient.restoreService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreService(); - // [END metastore_v1alpha_generated_DataprocMetastore_RestoreService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js deleted file mode 100644 index ebaafa5b56c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, metadataImport) { - // [START metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateMetadataImport() { - // Construct request - const request = { - updateMask, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.updateMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMetadataImport(); - // [END metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js deleted file mode 100644 index f5ff29edf8a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore.update_service.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, service) { - // [START metastore_v1alpha_generated_DataprocMetastore_UpdateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateService() { - // Construct request - const request = { - updateMask, - service, - }; - - // Run request - const [operation] = await metastoreClient.updateService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateService(); - // [END metastore_v1alpha_generated_DataprocMetastore_UpdateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js deleted file mode 100644 index cbb67ce1733..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, federationId, federation) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location in which to create a federation - * service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const federationId = 'abc123' - /** - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callCreateFederation() { - // Construct request - const request = { - parent, - federationId, - federation, - }; - - // Run request - const [operation] = await metastoreClient.createFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js deleted file mode 100644 index dae3bcd39ab..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callDeleteFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js deleted file mode 100644 index 2d6a21c6e5a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore federation to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callGetFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getFederation(request); - console.log(response); - } - - callGetFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js deleted file mode 100644 index 315f72aa06d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callListFederations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listFederationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFederations(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js deleted file mode 100644 index 215f126c0f4..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, federation) { - // [START metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1alpha; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callUpdateFederation() { - // Construct request - const request = { - updateMask, - federation, - }; - - // Run request - const [operation] = await metastoreClient.updateFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFederation(); - // [END metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json b/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json deleted file mode 100644 index 5c58d24311f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.metastore.v1alpha.json +++ /dev/null @@ -1,987 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-metastore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.metastore.v1alpha", - "version": "v1alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListServices_async", - "title": "DataprocMetastore listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists services in a project and location.", - "canonical": true, - "file": "dataproc_metastore.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListServicesResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListServices", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetService_async", - "title": "DataprocMetastore getService Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single service.", - "canonical": true, - "file": "dataproc_metastore.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.Service", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateService_async", - "title": "DataprocMetastore createService Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore service in a project and location.", - "canonical": true, - "file": "dataproc_metastore.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1alpha.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateService_async", - "title": "DataprocMetastore updateService Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single service.", - "canonical": true, - "file": "dataproc_metastore.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1alpha.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteService_async", - "title": "DataprocMetastore deleteService Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single service.", - "canonical": true, - "file": "dataproc_metastore.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async", - "title": "DataprocMetastore listMetadataImports Sample", - "origin": "API_DEFINITION", - "description": " Lists imports in a service.", - "canonical": true, - "file": "dataproc_metastore.list_metadata_imports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListMetadataImportsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListMetadataImports", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async", - "title": "DataprocMetastore getMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single import.", - "canonical": true, - "file": "dataproc_metastore.get_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.MetadataImport", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async", - "title": "DataprocMetastore createMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Creates a new MetadataImport in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import_id", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1alpha.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async", - "title": "DataprocMetastore updateMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", - "canonical": true, - "file": "dataproc_metastore.update_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1alpha.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.UpdateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async", - "title": "DataprocMetastore exportMetadata Sample", - "origin": "API_DEFINITION", - "description": " Exports metadata from a service.", - "canonical": true, - "file": "dataproc_metastore.export_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", - "async": true, - "parameters": [ - { - "name": "destination_gcs_folder", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "database_dump_type", - "type": ".google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ExportMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_RestoreService_async", - "title": "DataprocMetastore restoreService Sample", - "origin": "API_DEFINITION", - "description": " Restores a service from a backup.", - "canonical": true, - "file": "dataproc_metastore.restore_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - }, - { - "name": "restore_type", - "type": ".google.cloud.metastore.v1alpha.Restore.RestoreType" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.RestoreService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_ListBackups_async", - "title": "DataprocMetastore listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists backups in a service.", - "canonical": true, - "file": "dataproc_metastore.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListBackupsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_GetBackup_async", - "title": "DataprocMetastore getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single backup.", - "canonical": true, - "file": "dataproc_metastore.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.Backup", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.GetBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async", - "title": "DataprocMetastore createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.metastore.v1alpha.Backup" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.CreateBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async", - "title": "DataprocMetastore deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single backup.", - "canonical": true, - "file": "dataproc_metastore.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore.DeleteBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async", - "title": "DataprocMetastore listFederations Sample", - "origin": "API_DEFINITION", - "description": " Lists federations in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.list_federations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.ListFederationsResponse", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.ListFederations", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async", - "title": "DataprocMetastore getFederation Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.get_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1alpha.Federation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.GetFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async", - "title": "DataprocMetastore createFederation Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore federation in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.create_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "federation_id", - "type": "TYPE_STRING" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1alpha.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.CreateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async", - "title": "DataprocMetastore updateFederation Sample", - "origin": "API_DEFINITION", - "description": " Updates the fields of a federation.", - "canonical": true, - "file": "dataproc_metastore_federation.update_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1alpha.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.UpdateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async", - "title": "DataprocMetastore deleteFederation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.delete_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation.DeleteFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1alpha.DataprocMetastoreFederation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts deleted file mode 100644 index cc79e394c0b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1alpha from './v1alpha'; -const DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; -type DataprocMetastoreClient = v1alpha.DataprocMetastoreClient; -const DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; -type DataprocMetastoreFederationClient = v1alpha.DataprocMetastoreFederationClient; -export {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -export default {v1alpha, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts deleted file mode 100644 index 34fe31f390a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client.ts +++ /dev/null @@ -1,3173 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha/dataproc_metastore_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore services. - * Metastore services are fully managed, highly available, autoscaled, - * autohealing, OSS-native deployments of technical metadata management - * software. Each metastore service exposes a network endpoint through which - * metadata queries are served. Metadata queries can originate from a variety - * of sources, including Apache Hive, Apache Presto, and Apache Spark. - * - * The Dataproc Metastore API defines the following resource model: - * - * * The service works with a collection of Google Cloud projects, named: - * `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * (a location must refer to a Google Cloud `region`) - * * Each location has a collection of services, named: `/services/*` - * * Dataproc Metastore services are resources with names of the form: - * - * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @class - * @memberof v1alpha - */ -export class DataprocMetastoreClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DataprocMetastoreClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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 if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - lakePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/lakes/{lake}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listMetadataImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; - const createServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Service') as gax.protobuf.Type; - const updateServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteServiceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const createMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; - const createMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MetadataImport') as gax.protobuf.Type; - const updateMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const exportMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.MetadataExport') as gax.protobuf.Type; - const exportMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const restoreServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Restore') as gax.protobuf.Type; - const restoreServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServiceResponse.decode.bind(createServiceResponse), - createServiceMetadata.decode.bind(createServiceMetadata)), - updateService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServiceResponse.decode.bind(updateServiceResponse), - updateServiceMetadata.decode.bind(updateServiceMetadata)), - deleteService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServiceResponse.decode.bind(deleteServiceResponse), - deleteServiceMetadata.decode.bind(deleteServiceMetadata)), - createMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMetadataImportResponse.decode.bind(createMetadataImportResponse), - createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), - updateMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), - updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), - exportMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportMetadataResponse.decode.bind(exportMetadataResponse), - exportMetadataMetadata.decode.bind(exportMetadataMetadata)), - restoreService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreServiceResponse.decode.bind(restoreServiceResponse), - restoreServiceMetadata.decode.bind(restoreServiceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1alpha.DataprocMetastore', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.dataprocMetastoreStub) { - return this.dataprocMetastoreStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1alpha.DataprocMetastore. - this.dataprocMetastoreStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastore') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastore, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const dataprocMetastoreStubMethods = - ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup']; - for (const methodName of dataprocMetastoreStubMethods) { - const callPromise = this.dataprocMetastoreStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'metastore.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Service]{@link google.cloud.metastore.v1alpha.Service}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.get_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetService_async - */ - getService( - request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.cloud.metastore.v1alpha.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService, - protos.google.cloud.metastore.v1alpha.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getService(request, options, callback); - } -/** - * Gets details of a single import. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.get_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetMetadataImport_async - */ - getMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|undefined, {}|undefined - ]>; - getMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport, - protos.google.cloud.metastore.v1alpha.IGetMetadataImportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getMetadataImport(request, options, callback); - } -/** - * Gets details of a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.cloud.metastore.v1alpha.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.get_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.metastore.v1alpha.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup, - protos.google.cloud.metastore.v1alpha.IGetBackupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBackup(request, options, callback); - } - -/** - * Creates a metastore service in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.serviceId - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1alpha.Service} request.service - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async - */ - createService( - request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createService( - request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.cloud.metastore.v1alpha.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateService_async - */ - async checkCreateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1alpha.Service} request.service - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async - */ - updateService( - request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateService( - request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.cloud.metastore.v1alpha.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateService_async - */ - async checkUpdateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async - */ - deleteService( - request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.cloud.metastore.v1alpha.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteService_async - */ - async checkDeleteServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new MetadataImport in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.metadataImportId - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async - */ - createMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMetadataImport( - request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.ICreateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateMetadataImport_async - */ - async checkCreateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single import. - * Only the description field of MetadataImport is supported to be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1alpha.MetadataImport} request.metadataImport - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async - */ - updateMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request?: protos.google.cloud.metastore.v1alpha.IUpdateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metadata_import.name': request.metadataImport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_UpdateMetadataImport_async - */ - async checkUpdateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports metadata from a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.destinationGcsFolder - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {google.cloud.metastore.v1alpha.DatabaseDumpSpec.Type} [request.databaseDumpType] - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async - */ - exportMetadata( - request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportMetadata( - request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request?: protos.google.cloud.metastore.v1alpha.IExportMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ExportMetadata_async - */ - async checkExportMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a service from a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backup - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {google.cloud.metastore.v1alpha.Restore.RestoreType} [request.restoreType] - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async - */ - restoreService( - request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreService( - request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request?: protos.google.cloud.metastore.v1alpha.IRestoreServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.restore_service.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_RestoreService_async - */ - async checkRestoreServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new backup in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backupId - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1alpha.Backup} request.backup - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.metastore.v1alpha.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.create_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.metastore.v1alpha.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists services in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Service]{@link google.cloud.metastore.v1alpha.Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listServices( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService[], - protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, - protos.google.cloud.metastore.v1alpha.IListServicesResponse - ]>; - listServices( - request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>): void; - listServices( - request: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>): void; - listServices( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListServicesRequest, - protos.google.cloud.metastore.v1alpha.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IService>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IService[], - protos.google.cloud.metastore.v1alpha.IListServicesRequest|null, - protos.google.cloud.metastore.v1alpha.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Service]{@link google.cloud.metastore.v1alpha.Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listServicesStream( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Service]{@link google.cloud.metastore.v1alpha.Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.list_services.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListServices_async - */ - listServicesAsync( - request?: protos.google.cloud.metastore.v1alpha.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists imports in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMetadataImports( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport[], - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse - ]>; - listMetadataImports( - request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; - listMetadataImports( - request: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>): void; - listMetadataImports( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IMetadataImport>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IMetadataImport[], - protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1alpha.IListMetadataImportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listMetadataImports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMetadataImportsStream( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.createStream( - this.innerApiCalls.listMetadataImports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetadataImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [MetadataImport]{@link google.cloud.metastore.v1alpha.MetadataImport}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.list_metadata_imports.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListMetadataImports_async - */ - listMetadataImportsAsync( - request?: protos.google.cloud.metastore.v1alpha.IListMetadataImportsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.asyncIterate( - this.innerApiCalls['listMetadataImports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists backups in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Backup]{@link google.cloud.metastore.v1alpha.Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup[], - protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>): void; - listBackups( - request: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>): void; - listBackups( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IBackup>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IBackup[], - protos.google.cloud.metastore.v1alpha.IListBackupsRequest|null, - protos.google.cloud.metastore.v1alpha.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Backup]{@link google.cloud.metastore.v1alpha.Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1alpha.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.cloud.metastore.v1alpha.Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore.list_backups.js - * region_tag:metastore_v1alpha_generated_DataprocMetastore_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.metastore.v1alpha.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * 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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified lake resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} lake - * @returns {string} Resource name string. - */ - lakePath(project:string,location:string,lake:string) { - return this.pathTemplates.lakePathTemplate.render({ - project: project, - location: location, - lake: lake, - }); - } - - /** - * Parse the project from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).project; - } - - /** - * Parse the location from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).location; - } - - /** - * Parse the lake from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the lake. - */ - matchLakeFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).lake; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dataprocMetastoreStub && !this._terminated) { - return this.dataprocMetastoreStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json deleted file mode 100644 index 7e022b9adaf..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_client_config.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1alpha.DataprocMetastore": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListServices": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetService": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetadataImports": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts deleted file mode 100644 index 3677ca95b19..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client.ts +++ /dev/null @@ -1,1725 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha/dataproc_metastore_federation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore federation services. - * Dataproc Metastore Federation Service allows federating a collection of - * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc - * Metastores. The Federation Service exposes a gRPC URL through which metadata - * from the backend metastores are served at query time. - * - * The Dataproc Metastore Federation API defines the following resource model: - * * The service works with a collection of Google Cloud projects. - * * Each project has a collection of available locations. - * * Each location has a collection of federations. - * * Dataproc Metastore Federations are resources with names of the - * form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @class - * @memberof v1alpha - */ -export class DataprocMetastoreFederationClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreFederationClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DataprocMetastoreFederationClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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 if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listFederations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1alpha/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1alpha/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; - const createFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const updateFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.Federation') as gax.protobuf.Type; - const updateFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - const deleteFederationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1alpha.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFederationResponse.decode.bind(createFederationResponse), - createFederationMetadata.decode.bind(createFederationMetadata)), - updateFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFederationResponse.decode.bind(updateFederationResponse), - updateFederationMetadata.decode.bind(updateFederationMetadata)), - deleteFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFederationResponse.decode.bind(deleteFederationResponse), - deleteFederationMetadata.decode.bind(deleteFederationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1alpha.DataprocMetastoreFederation', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.dataprocMetastoreFederationStub) { - return this.dataprocMetastoreFederationStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1alpha.DataprocMetastoreFederation. - this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1alpha.DataprocMetastoreFederation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1alpha.DataprocMetastoreFederation, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const dataprocMetastoreFederationStubMethods = - ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; - for (const methodName of dataprocMetastoreFederationStubMethods) { - const callPromise = this.dataprocMetastoreFederationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreFederationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'metastore.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Federation]{@link google.cloud.metastore.v1alpha.Federation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.get_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_GetFederation_async - */ - getFederation( - request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|undefined, {}|undefined - ]>; - getFederation( - request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - callback: Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request?: protos.google.cloud.metastore.v1alpha.IGetFederationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation, - protos.google.cloud.metastore.v1alpha.IGetFederationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFederation(request, options, callback); - } - -/** - * Creates a metastore federation in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a federation - * service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.federationId - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1alpha.Federation} request.federation - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async - */ - createFederation( - request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFederation( - request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request?: protos.google.cloud.metastore.v1alpha.ICreateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_CreateFederation_async - */ - async checkCreateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the fields of a federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1alpha.Federation} request.federation - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - updateFederation( - request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFederation( - request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request?: protos.google.cloud.metastore.v1alpha.IUpdateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'federation.name': request.federation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - async checkUpdateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - deleteFederation( - request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFederation( - request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request?: protos.google.cloud.metastore.v1alpha.IDeleteFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - async checkDeleteFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists federations in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Federation]{@link google.cloud.metastore.v1alpha.Federation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFederations( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation[], - protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse - ]>; - listFederations( - request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>): void; - listFederations( - request: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>): void; - listFederations( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1alpha.IFederation>): - Promise<[ - protos.google.cloud.metastore.v1alpha.IFederation[], - protos.google.cloud.metastore.v1alpha.IListFederationsRequest|null, - protos.google.cloud.metastore.v1alpha.IListFederationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFederations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Federation]{@link google.cloud.metastore.v1alpha.Federation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFederationsStream( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.createStream( - this.innerApiCalls.listFederations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFederations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Federation]{@link google.cloud.metastore.v1alpha.Federation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha/dataproc_metastore_federation.list_federations.js - * region_tag:metastore_v1alpha_generated_DataprocMetastoreFederation_ListFederations_async - */ - listFederationsAsync( - request?: protos.google.cloud.metastore.v1alpha.IListFederationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.asyncIterate( - this.innerApiCalls['listFederations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * 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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dataprocMetastoreFederationStub && !this._terminated) { - return this.dataprocMetastoreFederationStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json deleted file mode 100644 index f764c70b10a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1alpha.DataprocMetastoreFederation": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListFederations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json deleted file mode 100644 index 5aa3fc8ef92..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_federation_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1alpha/metastore.proto", - "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json deleted file mode 100644 index 5aa3fc8ef92..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/dataproc_metastore_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1alpha/metastore.proto", - "../../protos/google/cloud/metastore/v1alpha/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json deleted file mode 100644 index ecfbf2278fa..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/gapic_metadata.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.metastore.v1alpha", - "libraryPackage": "@google-cloud/dataproc-metastore", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "DataprocMetastoreFederation": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts deleted file mode 100644 index 3e1ee876b29..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/src/v1alpha/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {DataprocMetastoreClient} from './dataproc_metastore_client'; -export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 74e7a6657af..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const metastore = require('@google-cloud/dataproc-metastore'); - -function main() { - const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); - const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index f10cef1cd2c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; - -// check that the client class type name can be used -function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { - client.close(); -} -function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dataprocMetastoreClient = new DataprocMetastoreClient(); - doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); - // check that the client instance can be created - const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); - doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts deleted file mode 100644 index 2c9ccd3dfda..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_federation_v1alpha.ts +++ /dev/null @@ -1,2000 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dataprocmetastorefederationModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha.DataprocMetastoreFederationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreFederationStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreFederationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getFederation', () => { - it('invokes getFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); - const [response] = await client.getFederation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFederation( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with closed client', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFederation(request), expectedError); - }); - }); - - describe('createFederation', () => { - it('invokes createFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFederation', () => { - it('invokes updateFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFederation', () => { - it('invokes deleteFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFederations', () => { - it('invokes listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); - const [response] = await client.listFederations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFederations( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IFederation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFederations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederationsStream without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFederationsStream with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Federation()), - ]; - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; - const iterable = client.listFederationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFederationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IFederation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastorefederationModule.v1alpha.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts b/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts deleted file mode 100644 index 4d6772b3e72..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/test/gapic_dataproc_metastore_v1alpha.ts +++ /dev/null @@ -1,3718 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dataprocmetastoreModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha.DataprocMetastoreClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastoreModule.v1alpha.DataprocMetastoreClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getService', () => { - it('invokes getService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('getMetadataImport', () => { - it('invokes getMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); - const [response] = await client.getMetadataImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetadataImport( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMetadataImport(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); - const [operation] = await client.createService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createMetadataImport', () => { - it('invokes createMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMetadataImport', () => { - it('invokes updateMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportMetadata', () => { - it('invokes exportMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreService', () => { - it('invokes restoreService without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreService(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRestoreServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetadataImports', () => { - it('invokes listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); - const [response] = await client.listMetadataImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetadataImports( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IMetadataImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetadataImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImportsStream without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetadataImportsStream with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; - const iterable = client.listMetadataImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetadataImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IMetadataImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1alpha.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1alpha.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1alpha.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1alpha.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1alpha.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1alpha.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1alpha.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('lake', () => { - const fakePath = "/rendered/path/lake"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - lake: "lakeValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.lakePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.lakePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('lakePath', () => { - const result = client.lakePath("projectValue", "locationValue", "lakeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.lakePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLakeName', () => { - const result = client.matchProjectFromLakeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLakeName', () => { - const result = client.matchLocationFromLakeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLakeFromLakeName', () => { - const result = client.matchLakeFromLakeName(fakePath); - assert.strictEqual(result, "lakeValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastoreModule.v1alpha.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js deleted file mode 100644 index 6fc45cb3d30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1alpha/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DataprocMetastore', - filename: './dataproc-metastore.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json b/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore b/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js deleted file mode 100644 index bc8b6fc164f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dataproc-metastore', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js b/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/README.md b/owl-bot-staging/google-cloud-metastore/v1beta/README.md deleted file mode 100644 index 24afb9017c6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Metastore: Nodejs Client diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json b/owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/package.json b/owl-bot-staging/google-cloud-metastore/v1beta/package.json deleted file mode 100644 index b3e0a6424ad..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/dataproc-metastore", - "version": "0.1.0", - "description": "Metastore client for Node.js", - "repository": "googleapis/nodejs-metastore", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google metastore", - "metastore", - "dataproc metastore", - "dataproc metastore federation" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto deleted file mode 100644 index 6259c124165..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore.proto +++ /dev/null @@ -1,1462 +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.metastore.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/dayofweek.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta;metastore"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreProto"; -option java_package = "com.google.cloud.metastore.v1beta"; -option php_namespace = "Google\\Cloud\\Metastore\\V1beta"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Subnetwork" - pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}" -}; -option (google.api.resource_definition) = { - type: "dataplex.googleapis.com/Lake" - pattern: "projects/{project}/locations/{location}/lakes/{lake}" -}; - -// Configures and manages metastore services. -// Metastore services are fully managed, highly available, autoscaled, -// autohealing, OSS-native deployments of technical metadata management -// software. Each metastore service exposes a network endpoint through which -// metadata queries are served. Metadata queries can originate from a variety -// of sources, including Apache Hive, Apache Presto, and Apache Spark. -// -// The Dataproc Metastore API defines the following resource model: -// -// * The service works with a collection of Google Cloud projects, named: -// `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// (a location must refer to a Google Cloud `region`) -// * Each location has a collection of services, named: `/services/*` -// * Dataproc Metastore services are resources with names of the form: -// -// `/projects/{project_number}/locations/{location_id}/services/{service_id}`. -service DataprocMetastore { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists services in a project and location. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single service. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore service in a project and location. - rpc CreateService(CreateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service,service_id"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Updates the parameters of a single service. - rpc UpdateService(UpdateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{service.name=projects/*/locations/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Service" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Deletes a single service. - rpc DeleteService(DeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/services/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Lists imports in a service. - rpc ListMetadataImports(ListMetadataImportsRequest) - returns (ListMetadataImportsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single import. - rpc GetMetadataImport(GetMetadataImportRequest) returns (MetadataImport) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/services/*/metadataImports/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new MetadataImport in a given project and location. - rpc CreateMetadataImport(CreateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/services/*}/metadataImports" - body: "metadata_import" - }; - option (google.api.method_signature) = - "parent,metadata_import,metadata_import_id"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Updates a single import. - // Only the description field of MetadataImport is supported to be updated. - rpc UpdateMetadataImport(UpdateMetadataImportRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{metadata_import.name=projects/*/locations/*/services/*/metadataImports/*}" - body: "metadata_import" - }; - option (google.api.method_signature) = "metadata_import,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "MetadataImport" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Exports metadata from a service. - rpc ExportMetadata(ExportMetadataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:exportMetadata" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "MetadataExport" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Restores a service from a backup. - rpc RestoreService(RestoreServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{service=projects/*/locations/*/services/*}:restore" - body: "*" - }; - option (google.api.method_signature) = "service,backup"; - option (google.longrunning.operation_info) = { - response_type: "Restore" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Lists backups in a service. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new backup in a given project and location. - rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*/services/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent,backup,backup_id"; - option (google.longrunning.operation_info) = { - response_type: "Backup" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Deletes a single backup. - rpc DeleteBackup(DeleteBackupRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/services/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } -} - -// A managed metastore service that serves metadata queries. -message Service { - option (google.api.resource) = { - type: "metastore.googleapis.com/Service" - pattern: "projects/{project}/locations/{location}/services/{service}" - }; - - // The current state of the metastore service. - enum State { - // The state of the metastore service is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore service is in the process of being created. - CREATING = 1; - - // The metastore service is running and ready to serve queries. - ACTIVE = 2; - - // The metastore service is entering suspension. Its query-serving - // availability may cease unexpectedly. - SUSPENDING = 3; - - // The metastore service is suspended and unable to serve queries. - SUSPENDED = 4; - - // The metastore service is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 5; - - // The metastore service is undergoing deletion. It cannot be used. - DELETING = 6; - - // The metastore service has encountered an error and cannot be used. The - // metastore service should be deleted. - ERROR = 7; - } - - // Available service tiers. - enum Tier { - // The tier is not set. - TIER_UNSPECIFIED = 0; - - // The developer tier provides limited scalability and no fault tolerance. - // Good for low-cost proof-of-concept. - DEVELOPER = 1; - - // The enterprise tier provides multi-zone high availability, and sufficient - // scalability for enterprise-level Dataproc Metastore workloads. - ENTERPRISE = 3; - } - - // Release channels bundle features of varying levels of stability. Newer - // features may be introduced initially into less stable release channels and - // can be automatically promoted into more stable release channels. - enum ReleaseChannel { - // Release channel is not specified. - RELEASE_CHANNEL_UNSPECIFIED = 0; - - // The `CANARY` release channel contains the newest features, which may be - // unstable and subject to unresolved issues with no known workarounds. - // Services using the `CANARY` release channel are not subject to any SLAs. - CANARY = 1; - - // The `STABLE` release channel contains features that are considered stable - // and have been validated for production use. - STABLE = 2; - } - - // The backend database type for the metastore service. - enum DatabaseType { - // The DATABASE_TYPE is not set. - DATABASE_TYPE_UNSPECIFIED = 0; - - // MySQL is used to persist the metastore data. - MYSQL = 1; - - // Spanner is used to persist the metastore data. - SPANNER = 2; - } - - // Configuration properties specific to the underlying metastore service - // technology (the software that serves metastore queries). - oneof metastore_config { - // Configuration information specific to running Hive metastore - // software as the metastore service. - HiveMetastoreConfig hive_metastore_config = 5; - } - - // Immutable. The relative resource name of the metastore service, in the - // following format: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore service was created. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore service was last updated. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore service. - map labels = 4; - - // Immutable. The relative resource name of the VPC network on which the - // instance can be accessed. It is specified in the following form: - // - // `projects/{project_number}/global/networks/{network_id}`. - string network = 7 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; - - // Output only. The URI of the endpoint used to access the metastore service. - string endpoint_uri = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The TCP port at which the metastore service is reached. Default: 9083. - int32 port = 9; - - // Output only. The current state of the metastore service. - State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the - // metastore service, if available. - string state_message = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A Cloud Storage URI (starting with `gs://`) that specifies - // where artifacts related to the metastore service are stored. - string artifact_gcs_uri = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The tier of the service. - Tier tier = 13; - - // The setting that defines how metastore metadata should be integrated with - // external services and systems. - MetadataIntegration metadata_integration = 14; - - // The one hour maintenance window of the metastore service. This specifies - // when the service can be restarted for maintenance purposes in UTC time. - // Maintenance window is not needed for services with the SPANNER - // database type. - MaintenanceWindow maintenance_window = 15; - - // Output only. The globally unique resource identifier of the metastore - // service. - string uid = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The metadata management activities of the metastore service. - MetadataManagementActivity metadata_management_activity = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The release channel of the service. - // If unspecified, defaults to `STABLE`. - ReleaseChannel release_channel = 19 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. Information used to configure the Dataproc Metastore service to - // encrypt customer data at rest. Cannot be updated. - EncryptionConfig encryption_config = 20 - [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying the network settings for the - // Dataproc Metastore service. - NetworkConfig network_config = 21; - - // Immutable. The database type that the Metastore service stores its data. - DatabaseType database_type = 22 [(google.api.field_behavior) = IMMUTABLE]; - - // The configuration specifying telemetry settings for the Dataproc Metastore - // service. If unspecified defaults to `JSON`. - TelemetryConfig telemetry_config = 23; -} - -// Specifies how metastore metadata should be integrated with external services. -message MetadataIntegration { - // The integration config for the Data Catalog service. - DataCatalogConfig data_catalog_config = 1; - - // The integration config for the Dataplex service. - DataplexConfig dataplex_config = 2; -} - -// Specifies how metastore metadata should be integrated with the Data Catalog -// service. -message DataCatalogConfig { - // Defines whether the metastore metadata should be synced to Data Catalog. - // The default value is to disable syncing metastore metadata to Data Catalog. - bool enabled = 2; -} - -// Specifies how metastore metadata should be integrated with the Dataplex -// service. -message DataplexConfig { - // A reference to the Lake resources that this metastore service is attached - // to. The key is the lake resource name. Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}`. - map lake_resources = 1; -} - -// Represents a Lake resource -message Lake { - // The Lake resource name. - // Example: - // `projects/{project_number}/locations/{location_id}/lakes/{lake_id}` - string name = 1 [ - (google.api.resource_reference) = { type: "dataplex.googleapis.com/Lake" } - ]; -} - -// Maintenance window. This specifies when Dataproc Metastore -// may perform system maintenance operation to the service. -message MaintenanceWindow { - // The hour of day (0-23) when the window starts. - google.protobuf.Int32Value hour_of_day = 1; - - // The day of week, when the window starts. - google.type.DayOfWeek day_of_week = 2; -} - -// Specifies configuration information specific to running Hive metastore -// software as the metastore service. -message HiveMetastoreConfig { - // Protocols available for serving the metastore service endpoint. - enum EndpointProtocol { - // The protocol is not set. - ENDPOINT_PROTOCOL_UNSPECIFIED = 0; - - // Use the legacy Apache Thrift protocol for the metastore service endpoint. - THRIFT = 1; - - // Use the modernized gRPC protocol for the metastore service endpoint. - GRPC = 2; - } - - // Immutable. The Hive metastore schema version. - string version = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // Hive metastore (configured in `hive-site.xml`). The mappings - // override system defaults (some keys cannot be overridden). These - // overrides are also applied to auxiliary versions and can be further - // customized in the auxiliary version's `AuxiliaryVersionConfig`. - map config_overrides = 2; - - // Information used to configure the Hive metastore service as a service - // principal in a Kerberos realm. To disable Kerberos, use the `UpdateService` - // method and specify this field's path - // (`hive_metastore_config.kerberos_config`) in the request's `update_mask` - // while omitting this field from the request's `service`. - KerberosConfig kerberos_config = 3; - - // The protocol to use for the metastore service endpoint. If unspecified, - // defaults to `THRIFT`. - EndpointProtocol endpoint_protocol = 4; - - // A mapping of Hive metastore version to the auxiliary version - // configuration. When specified, a secondary Hive metastore service is - // created along with the primary service. All auxiliary versions must be less - // than the service's primary version. The key is the auxiliary service name - // and it must match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. This - // means that the first character must be a lowercase letter, and all the - // following characters must be hyphens, lowercase letters, or digits, except - // the last character, which cannot be a hyphen. - map auxiliary_versions = 5; -} - -// Configuration information for a Kerberos principal. -message KerberosConfig { - // A Kerberos keytab file that can be used to authenticate a service principal - // with a Kerberos Key Distribution Center (KDC). - Secret keytab = 1; - - // A Kerberos principal that exists in the both the keytab the KDC - // to authenticate as. A typical principal is of the form - // `primary/instance@REALM`, but there is no exact format. - string principal = 2; - - // A Cloud Storage URI that specifies the path to a - // krb5.conf file. It is of the form `gs://{bucket_name}/path/to/krb5.conf`, - // although the file does not need to be named krb5.conf explicitly. - string krb5_config_gcs_uri = 3; -} - -// A securely stored value. -message Secret { - oneof value { - // The relative resource name of a Secret Manager secret version, in the - // following form: - // - // `projects/{project_number}/secrets/{secret_id}/versions/{version_id}`. - string cloud_secret = 2; - } -} - -// Encryption settings for the service. -message EncryptionConfig { - // The fully qualified customer provided Cloud KMS key name to use for - // customer data encryption, in the following form: - // - // `projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}`. - string kms_key = 1; -} - -// Configuration information for the auxiliary service versions. -message AuxiliaryVersionConfig { - // The Hive metastore version of the auxiliary service. It must be less - // than the primary Hive metastore service's version. - string version = 1; - - // A mapping of Hive metastore configuration key-value pairs to apply to the - // auxiliary Hive metastore (configured in `hive-site.xml`) in addition to - // the primary version's overrides. If keys are present in both the auxiliary - // version's overrides and the primary version's overrides, the value from - // the auxiliary version's overrides takes precedence. - map config_overrides = 2; - - // Output only. The network configuration contains the endpoint URI(s) of the - // auxiliary Hive metastore service. - NetworkConfig network_config = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Network configuration for the Dataproc Metastore service. -message NetworkConfig { - // Contains information of the customer's network configurations. - message Consumer { - oneof vpc_resource { - // Immutable. The subnetwork of the customer project from which an IP - // address is reserved and used as the Dataproc Metastore service's - // endpoint. It is accessible to hosts in the subnet and to all - // hosts in a subnet in the same region and same network. There must - // be at least one IP address available in the subnet's primary range. The - // subnet is specified in the following form: - // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` - string subnetwork = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Subnetwork" - } - ]; - } - - // Output only. The URI of the endpoint used to access the metastore - // service. - string endpoint_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Immutable. The consumer-side network configuration for the Dataproc - // Metastore instance. - repeated Consumer consumers = 1 [(google.api.field_behavior) = IMMUTABLE]; -} - -// Telemetry Configuration for the Dataproc Metastore service. -message TelemetryConfig { - enum LogFormat { - // The LOG_FORMAT is not set. - LOG_FORMAT_UNSPECIFIED = 0; - - // Logging output uses the legacy `textPayload` format. - LEGACY = 1; - - // Logging output uses the `jsonPayload` format. - JSON = 2; - } - - // The output format of the Dataproc Metastore service's logs. - LogFormat log_format = 1; -} - -// The metadata management activities of the metastore service. -message MetadataManagementActivity { - // Output only. The latest metadata exports of the metastore service. - repeated MetadataExport metadata_exports = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The latest restores of the metastore service. - repeated Restore restores = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A metastore resource that imports metadata. -message MetadataImport { - option (google.api.resource) = { - type: "metastore.googleapis.com/MetadataImport" - pattern: "projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}" - }; - - // A specification of the location of and metadata about a database dump from - // a relational database management system. - message DatabaseDump { - // The type of the database. - enum DatabaseType { - // The type of the source database is unknown. - DATABASE_TYPE_UNSPECIFIED = 0; - - // The type of the source database is MySQL. - MYSQL = 1; - } - - // The type of the database. - DatabaseType database_type = 1 [deprecated = true]; - - // A Cloud Storage object or folder URI that specifies the source from which - // to import metadata. It must begin with `gs://`. - string gcs_uri = 2; - - // The name of the source database. - string source_database = 3 [deprecated = true]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type type = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // The current state of the metadata import. - enum State { - // The state of the metadata import is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata import is running. - RUNNING = 1; - - // The metadata import completed successfully. - SUCCEEDED = 2; - - // The metadata import is being updated. - UPDATING = 3; - - // The metadata import failed, and attempted metadata changes were rolled - // back. - FAILED = 4; - } - - // The metadata to be imported. - oneof metadata { - // Immutable. A database dump from a pre-existing metastore's database. - DatabaseDump database_dump = 6 [(google.api.field_behavior) = IMMUTABLE]; - } - - // Immutable. The relative resource name of the metadata import, of the form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The description of the metadata import. - string description = 2; - - // Output only. The time when the metadata import was started. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import was last updated. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metadata import finished. - google.protobuf.Timestamp end_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the metadata import. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata export operation. -message MetadataExport { - // The current state of the metadata export. - enum State { - // The state of the metadata export is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata export is running. - RUNNING = 1; - - // The metadata export completed successfully. - SUCCEEDED = 2; - - // The metadata export failed. - FAILED = 3; - - // The metadata export is cancelled. - CANCELLED = 4; - } - - oneof destination { - // Output only. A Cloud Storage URI of a folder that metadata are exported - // to, in the form of - // `gs:////`, where - // `` is automatically generated. - string destination_gcs_uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The time when the export started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the export ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the export. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of the database dump. - DatabaseDumpSpec.Type database_dump_type = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a backup resource. -message Backup { - option (google.api.resource) = { - type: "metastore.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/services/{service}/backups/{backup}" - }; - - // The current state of the backup. - enum State { - // The state of the backup is unknown. - STATE_UNSPECIFIED = 0; - - // The backup is being created. - CREATING = 1; - - // The backup is being deleted. - DELETING = 2; - - // The backup is active and ready to use. - ACTIVE = 3; - - // The backup failed. - FAILED = 4; - - // The backup is being restored. - RESTORING = 5; - } - - // Immutable. The relative resource name of the backup, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the backup was started. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the backup finished creating. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the backup. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The revision of the service at the time of backup. - Service service_revision = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of the backup. - string description = 6; - - // Output only. Services that are restoring from the backup. - repeated string restoring_services = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The details of a metadata restore operation. -message Restore { - // The current state of the restore. - enum State { - // The state of the metadata restore is unknown. - STATE_UNSPECIFIED = 0; - - // The metadata restore is running. - RUNNING = 1; - - // The metadata restore completed successfully. - SUCCEEDED = 2; - - // The metadata restore failed. - FAILED = 3; - - // The metadata restore is cancelled. - CANCELLED = 4; - } - - // The type of restore. If unspecified, defaults to `METADATA_ONLY`. - enum RestoreType { - // The restore type is unknown. - RESTORE_TYPE_UNSPECIFIED = 0; - - // The service's metadata and configuration are restored. - FULL = 1; - - // Only the service's metadata is restored. - METADATA_ONLY = 2; - } - - // Output only. The time when the restore started. - google.protobuf.Timestamp start_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the restore ended. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the restore. - State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Output only. The type of restore. - RestoreType type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The restore details containing the revision of the service to - // be restored to, in format of JSON. - string details = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. -message ListServicesRequest { - // Required. The relative resource name of the location of metastore services - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. The maximum number of services to return. The response may - // contain less than the maximum number. If unspecified, no more than 500 - // services are returned. The maximum value is 1000; values above 1000 are - // changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices]. -message ListServicesResponse { - // The services in the specified location. - repeated Service services = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetService][google.cloud.metastore.v1beta.DataprocMetastore.GetService]. -message GetServiceRequest { - // Required. The relative resource name of the metastore service to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateService][google.cloud.metastore.v1beta.DataprocMetastore.CreateService]. -message CreateServiceRequest { - // Required. The relative resource name of the location in which to create a - // metastore service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The ID of the metastore service, which is used as the final - // component of the metastore service's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string service_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore service to create. The `name` field is - // ignored. The ID of the created metastore service must be provided in - // the request's `service_id` field. - Service service = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateService][google.cloud.metastore.v1beta.DataprocMetastore.UpdateService]. -message UpdateServiceRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore service resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore service to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore service's `name` field is used to identify the metastore - // service to be updated. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteService][google.cloud.metastore.v1beta.DataprocMetastore.DeleteService]. -message DeleteServiceRequest { - // Required. The relative resource name of the metastore service to delete, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsRequest { - // Required. The relative resource name of the service whose metadata imports - // to list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Optional. The maximum number of imports to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 imports are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListServices][google.cloud.metastore.v1beta.DataprocMetastore.ListServices] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports]. -message ListMetadataImportsResponse { - // The imports in the specified service. - repeated MetadataImport metadata_imports = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport]. -message GetMetadataImportRequest { - // Required. The relative resource name of the metadata import to retrieve, in - // the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/MetadataImport" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport]. -message CreateMetadataImportRequest { - // Required. The relative resource name of the service in which to create a - // metastore import, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/MetadataImport" - } - ]; - - // Required. The ID of the metadata import, which is used as the final - // component of the metadata import's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string metadata_import_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to create. The `name` field is ignored. The - // ID of the created metadata import must be provided in the request's - // `metadata_import_id` field. - MetadataImport metadata_import = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.UpdateMetadataImport][google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport]. -message UpdateMetadataImportRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metadata import resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The metadata import to update. The server only merges fields - // in the import if they are specified in `update_mask`. - // - // The metadata import's `name` field is used to identify the metastore - // import to be updated. - MetadataImport metadata_import = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. -message ListBackupsRequest { - // Required. The relative resource name of the service whose backups to - // list, in the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The maximum number of backups to return. The response may contain - // less than the maximum number. If unspecified, no more than 500 backups are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups] - // must match the call that provided the page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [DataprocMetastore.ListBackups][google.cloud.metastore.v1beta.DataprocMetastore.ListBackups]. -message ListBackupsResponse { - // The backups of the specified service. - repeated Backup backups = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for -// [DataprocMetastore.GetBackup][google.cloud.metastore.v1beta.DataprocMetastore.GetBackup]. -message GetBackupRequest { - // Required. The relative resource name of the backup to retrieve, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; -} - -// Request message for -// [DataprocMetastore.CreateBackup][google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup]. -message CreateBackupRequest { - // Required. The relative resource name of the service in which to create a - // backup of the following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Backup" - } - ]; - - // Required. The ID of the backup, which is used as the final component of the - // backup's name. - // - // This value must be between 1 and 64 characters long, begin with a letter, - // end with a letter or number, and consist of alpha-numeric ASCII characters - // or hyphens. - string backup_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The backup to create. The `name` field is ignored. The ID of the - // created backup must be provided in the request's `backup_id` field. - Backup backup = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.DeleteBackup][google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup]. -message DeleteBackupRequest { - // Required. The relative resource name of the backup to delete, in the - // following form: - // - // `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for -// [DataprocMetastore.ExportMetadata][google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata]. -message ExportMetadataRequest { - // Required. Destination that metadata is exported to. - oneof destination { - // A Cloud Storage URI of a folder, in the format - // `gs:///`. A sub-folder - // `` containing exported files will be created below it. - string destination_gcs_folder = 2; - } - - // Required. The relative resource name of the metastore service to run - // export, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of the database dump. If unspecified, defaults to - // `MYSQL`. - DatabaseDumpSpec.Type database_dump_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [DataprocMetastore.Restore][]. -message RestoreServiceRequest { - // Required. The relative resource name of the metastore service to run - // restore, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}`. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Service" - } - ]; - - // Required. The relative resource name of the metastore service backup to - // restore from, in the following form: - // - // `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - string backup = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Backup" - } - ]; - - // Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - Restore.RestoreType restore_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A request ID. Specify a unique request ID to allow the server to - // ignore the request if it has completed. The server will ignore subsequent - // requests that provide a duplicate request ID for at least 60 minutes after - // the first request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of a long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the caller has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Metadata about the service in a location. -message LocationMetadata { - // A specification of a supported version of the Hive Metastore software. - message HiveMetastoreVersion { - // The semantic version of the Hive Metastore software. - string version = 1; - - // Whether `version` will be chosen by the server if a metastore service is - // created with a `HiveMetastoreConfig` that omits the `version`. - bool is_default = 2; - } - - // The versions of Hive Metastore that can be used when creating a new - // metastore service in this location. The server guarantees that exactly one - // `HiveMetastoreVersion` in the list will set `is_default`. - repeated HiveMetastoreVersion supported_hive_metastore_versions = 1; -} - -// The specification of database dump to import from or export to. -message DatabaseDumpSpec { - // The type of the database dump. - enum Type { - // The type of the database dump is unknown. - TYPE_UNSPECIFIED = 0; - - // Database dump is a MySQL dump file. - MYSQL = 1; - - // Database dump contains Avro files. - AVRO = 2; - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto b/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto deleted file mode 100644 index c0798f7bada..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/protos/google/cloud/metastore/v1beta/metastore_federation.proto +++ /dev/null @@ -1,364 +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.metastore.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta;metastore"; -option java_multiple_files = true; -option java_outer_classname = "MetastoreFederationProto"; -option java_package = "com.google.cloud.metastore.v1beta"; - -// Configures and manages metastore federation services. -// Dataproc Metastore Federation Service allows federating a collection of -// backend metastores like BigQuery, Dataplex Lakes, and other Dataproc -// Metastores. The Federation Service exposes a gRPC URL through which metadata -// from the backend metastores are served at query time. -// -// The Dataproc Metastore Federation API defines the following resource model: -// * The service works with a collection of Google Cloud projects. -// * Each project has a collection of available locations. -// * Each location has a collection of federations. -// * Dataproc Metastore Federations are resources with names of the -// form: -// `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. -service DataprocMetastoreFederation { - option (google.api.default_host) = "metastore.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists federations in a project and location. - rpc ListFederations(ListFederationsRequest) returns (ListFederationsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/locations/*}/federations" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a single federation. - rpc GetFederation(GetFederationRequest) returns (Federation) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a metastore federation in a project and location. - rpc CreateFederation(CreateFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*/locations/*}/federations" - body: "federation" - }; - option (google.api.method_signature) = "parent,federation,federation_id"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Updates the fields of a federation. - rpc UpdateFederation(UpdateFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta/{federation.name=projects/*/locations/*/federations/*}" - body: "federation" - }; - option (google.api.method_signature) = "federation,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Federation" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } - - // Deletes a single federation. - rpc DeleteFederation(DeleteFederationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/locations/*/federations/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.cloud.metastore.v1beta.OperationMetadata" - }; - } -} - -// Represents a federation of multiple backend metastores. -message Federation { - option (google.api.resource) = { - type: "metastore.googleapis.com/Federation" - pattern: "projects/{project}/locations/{location}/federations/{federation}" - }; - - // The current state of the federation. - enum State { - // The state of the metastore federation is unknown. - STATE_UNSPECIFIED = 0; - - // The metastore federation is in the process of being created. - CREATING = 1; - - // The metastore federation is running and ready to serve queries. - ACTIVE = 2; - - // The metastore federation is being updated. It remains usable but cannot - // accept additional update requests or be deleted at this time. - UPDATING = 3; - - // The metastore federation is undergoing deletion. It cannot be used. - DELETING = 4; - - // The metastore federation has encountered an error and cannot be used. The - // metastore federation should be deleted. - ERROR = 5; - } - - // Immutable. The relative resource name of the federation, of the - // form: - // projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time when the metastore federation was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when the metastore federation was last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User-defined labels for the metastore federation. - map labels = 4; - - // Immutable. The Apache Hive metastore version of the federation. All backend metastore - // versions must be compatible with the federation version. - string version = 5 [(google.api.field_behavior) = IMMUTABLE]; - - // A map from `BackendMetastore` rank to `BackendMetastore`s from which the - // federation service serves metadata at query time. The map key represents - // the order in which `BackendMetastore`s should be evaluated to resolve - // database names at query time and should be greater than or equal to zero. A - // `BackendMetastore` with a lower number will be evaluated before a - // `BackendMetastore` with a higher number. - map backend_metastores = 6; - - // Output only. The federation endpoint. - string endpoint_uri = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the federation. - State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current state of the metastore federation, - // if available. - string state_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The globally unique resource identifier of the metastore federation. - string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a backend metastore for the federation. -message BackendMetastore { - // The type of the backend metastore. - enum MetastoreType { - // The metastore type is not set. - METASTORE_TYPE_UNSPECIFIED = 0; - - // The backend metastore is BigQuery. - BIGQUERY = 2; - - // The backend metastore is Dataproc Metastore. - DATAPROC_METASTORE = 3; - } - - // The relative resource name of the metastore that is being federated. - // The formats of the relative resource names for the currently supported - // metastores are listed below: - // - // * Dataplex - // * `projects/{project_id}/locations/{location}/lakes/{lake_id}` - // * BigQuery - // * `projects/{project_id}` - // * Dataproc Metastore - // * `projects/{project_id}/locations/{location}/services/{service_id}` - string name = 1; - - // The type of the backend metastore. - MetastoreType metastore_type = 2; -} - -// Request message for ListFederations. -message ListFederationsRequest { - // Required. The relative resource name of the location of metastore federations - // to list, in the following form: - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. The maximum number of federations to return. The response may contain less - // than the maximum number. If unspecified, no more than 500 services are - // returned. The maximum value is 1000; values above 1000 are changed to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous ListFederationServices - // call. Provide this token to retrieve the subsequent page. - // - // To retrieve the first page, supply an empty page token. - // - // When paginating, other parameters provided to - // ListFederationServices must match the call that provided the - // page token. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The filter to apply to list results. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specify the ordering of results as described in [Sorting - // Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - // If not specified, the results will be sorted in the default order. - string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListFederations -message ListFederationsResponse { - // The services in the specified location. - repeated Federation federations = 1; - - // A token that can be sent as `page_token` to retrieve the next page. If this - // field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for GetFederation. -message GetFederationRequest { - // Required. The relative resource name of the metastore federation to retrieve, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; -} - -// Request message for CreateFederation. -message CreateFederationRequest { - // Required. The relative resource name of the location in which to create a federation - // service, in the following form: - // - // `projects/{project_number}/locations/{location_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "metastore.googleapis.com/Federation" - } - ]; - - // Required. The ID of the metastore federation, which is used as the final - // component of the metastore federation's name. - // - // This value must be between 2 and 63 characters long inclusive, begin with a - // letter, end with a letter or number, and consist of alpha-numeric - // ASCII characters or hyphens. - string federation_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Metastore Federation to create. The `name` field is - // ignored. The ID of the created metastore federation must be - // provided in the request's `federation_id` field. - Federation federation = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for UpdateFederation. -message UpdateFederationRequest { - // Required. A field mask used to specify the fields to be overwritten in the - // metastore federation resource by the update. - // Fields specified in the `update_mask` are relative to the resource (not - // to the full request). A field is overwritten if it is in the mask. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The metastore federation to update. The server only merges fields - // in the service if they are specified in `update_mask`. - // - // The metastore federation's `name` field is used to identify the - // metastore service to be updated. - Federation federation = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for DeleteFederation. -message DeleteFederationRequest { - // Required. The relative resource name of the metastore federation to delete, - // in the following form: - // - // `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "metastore.googleapis.com/Federation" - } - ]; - - // Optional. A request ID. Specify a unique request ID to allow the server to ignore the - // request if it has completed. The server will ignore subsequent requests - // that provide a duplicate request ID for at least 60 minutes after the first - // request. - // - // For example, if an initial request times out, followed by another request - // with the same request ID, the server ignores the second request to prevent - // the creation of duplicate commitments. - // - // The request ID must be a valid - // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - // A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js deleted file mode 100644 index f24171ffbd8..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_backup.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, backupId, backup) { - // [START metastore_v1beta_generated_DataprocMetastore_CreateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const backupId = 'abc123' - /** - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - */ - // const backup = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backupId, - backup, - }; - - // Run request - const [operation] = await metastoreClient.createBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateBackup(); - // [END metastore_v1beta_generated_DataprocMetastore_CreateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js deleted file mode 100644 index c08664914ff..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_metadata_import.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, metadataImportId, metadataImport) { - // [START metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - */ - // const metadataImportId = 'abc123' - /** - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateMetadataImport() { - // Construct request - const request = { - parent, - metadataImportId, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.createMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMetadataImport(); - // [END metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js deleted file mode 100644 index 5373570348d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.create_service.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, serviceId, service) { - // [START metastore_v1beta_generated_DataprocMetastore_CreateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const serviceId = 'abc123' - /** - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - serviceId, - service, - }; - - // Run request - const [operation] = await metastoreClient.createService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateService(); - // [END metastore_v1beta_generated_DataprocMetastore_CreateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js deleted file mode 100644 index 5b880b8fdb5..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_backup.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the backup to delete, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteBackup(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteBackup(); - // [END metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js deleted file mode 100644 index 2d768c7583b..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.delete_service.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastore_DeleteService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteService(); - // [END metastore_v1beta_generated_DataprocMetastore_DeleteService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js deleted file mode 100644 index 6ff2ada6aa4..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.export_metadata.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(service) { - // [START metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - */ - // const destinationGcsFolder = 'abc123' - /** - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - /** - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - */ - // const databaseDumpType = {} - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callExportMetadata() { - // Construct request - const request = { - service, - }; - - // Run request - const [operation] = await metastoreClient.exportMetadata(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportMetadata(); - // [END metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js deleted file mode 100644 index 93ebad0f55d..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_backup.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastore_GetBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END metastore_v1beta_generated_DataprocMetastore_GetBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js deleted file mode 100644 index 8ff7acc3d96..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_metadata_import.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetMetadataImport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getMetadataImport(request); - console.log(response); - } - - callGetMetadataImport(); - // [END metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js deleted file mode 100644 index e43c7d1e32f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.get_service.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastore_GetService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getService(request); - console.log(response); - } - - callGetService(); - // [END metastore_v1beta_generated_DataprocMetastore_GetService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js deleted file mode 100644 index 260e0d70212..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_backups.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1beta_generated_DataprocMetastore_ListBackups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListBackups google.cloud.metastore.v1beta.DataprocMetastore.ListBackups - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END metastore_v1beta_generated_DataprocMetastore_ListBackups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js deleted file mode 100644 index 7933d98e2c1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListMetadataImports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listMetadataImportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetadataImports(); - // [END metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js deleted file mode 100644 index a0c3279e5a3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.list_services.js +++ /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 -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1beta_generated_DataprocMetastore_ListServices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * DataprocMetastore.ListServices google.cloud.metastore.v1beta.DataprocMetastore.ListServices - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END metastore_v1beta_generated_DataprocMetastore_ListServices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js deleted file mode 100644 index db907b07a0a..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.restore_service.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(service, backup) { - // [START metastore_v1beta_generated_DataprocMetastore_RestoreService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - */ - // const service = 'abc123' - /** - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - */ - // const backup = 'abc123' - /** - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - */ - // const restoreType = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callRestoreService() { - // Construct request - const request = { - service, - backup, - }; - - // Run request - const [operation] = await metastoreClient.restoreService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreService(); - // [END metastore_v1beta_generated_DataprocMetastore_RestoreService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js deleted file mode 100644 index 588931bd1b4..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_metadata_import.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, metadataImport) { - // [START metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - */ - // const metadataImport = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateMetadataImport() { - // Construct request - const request = { - updateMask, - metadataImport, - }; - - // Run request - const [operation] = await metastoreClient.updateMetadataImport(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateMetadataImport(); - // [END metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js deleted file mode 100644 index f40c0fbe174..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore.update_service.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, service) { - // [START metastore_v1beta_generated_DataprocMetastore_UpdateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - */ - // const service = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreClient(); - - async function callUpdateService() { - // Construct request - const request = { - updateMask, - service, - }; - - // Run request - const [operation] = await metastoreClient.updateService(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateService(); - // [END metastore_v1beta_generated_DataprocMetastore_UpdateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js deleted file mode 100644 index 46d3f5e8ed5..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.create_federation.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, federationId, federation) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location in which to create a federation - * service, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - */ - // const federationId = 'abc123' - /** - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callCreateFederation() { - // Construct request - const request = { - parent, - federationId, - federation, - }; - - // Run request - const [operation] = await metastoreClient.createFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js deleted file mode 100644 index 56bfc499c7c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callDeleteFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await metastoreClient.deleteFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js deleted file mode 100644 index bbbcb0f0d31..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.get_federation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the metastore federation to retrieve, - * in the following form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - */ - // const name = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callGetFederation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await metastoreClient.getFederation(request); - console.log(response); - } - - callGetFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js deleted file mode 100644 index 26bcb306912..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.list_federations.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * To retrieve the first page, supply an empty page token. - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - */ - // const pageToken = 'abc123' - /** - * Optional. The filter to apply to list results. - */ - // const filter = 'abc123' - /** - * Optional. Specify the ordering of results as described in Sorting - * Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callListFederations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await metastoreClient.listFederationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFederations(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js deleted file mode 100644 index 7789d713fe3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/dataproc_metastore_federation.update_federation.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(updateMask, federation) { - // [START metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - */ - // const updateMask = {} - /** - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - */ - // const federation = {} - /** - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * The request ID must be a valid - * UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - */ - // const requestId = 'abc123' - - // Imports the Metastore library - const {DataprocMetastoreFederationClient} = require('@google-cloud/dataproc-metastore').v1beta; - - // Instantiates a client - const metastoreClient = new DataprocMetastoreFederationClient(); - - async function callUpdateFederation() { - // Construct request - const request = { - updateMask, - federation, - }; - - // Run request - const [operation] = await metastoreClient.updateFederation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateFederation(); - // [END metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json b/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json deleted file mode 100644 index 574e60eea15..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.metastore.v1beta.json +++ /dev/null @@ -1,987 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-metastore", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.metastore.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListServices_async", - "title": "DataprocMetastore listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists services in a project and location.", - "canonical": true, - "file": "dataproc_metastore.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListServicesResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListServices", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetService_async", - "title": "DataprocMetastore getService Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single service.", - "canonical": true, - "file": "dataproc_metastore.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.Service", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateService_async", - "title": "DataprocMetastore createService Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore service in a project and location.", - "canonical": true, - "file": "dataproc_metastore.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1beta.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateService_async", - "title": "DataprocMetastore updateService Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single service.", - "canonical": true, - "file": "dataproc_metastore.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "service", - "type": ".google.cloud.metastore.v1beta.Service" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteService_async", - "title": "DataprocMetastore deleteService Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single service.", - "canonical": true, - "file": "dataproc_metastore.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async", - "title": "DataprocMetastore listMetadataImports Sample", - "origin": "API_DEFINITION", - "description": " Lists imports in a service.", - "canonical": true, - "file": "dataproc_metastore.list_metadata_imports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListMetadataImportsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListMetadataImports", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListMetadataImports", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async", - "title": "DataprocMetastore getMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single import.", - "canonical": true, - "file": "dataproc_metastore.get_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.MetadataImport", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async", - "title": "DataprocMetastore createMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Creates a new MetadataImport in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import_id", - "type": "TYPE_STRING" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1beta.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async", - "title": "DataprocMetastore updateMetadataImport Sample", - "origin": "API_DEFINITION", - "description": " Updates a single import. Only the description field of MetadataImport is supported to be updated.", - "canonical": true, - "file": "dataproc_metastore.update_metadata_import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "metadata_import", - "type": ".google.cloud.metastore.v1beta.MetadataImport" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "UpdateMetadataImport", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.UpdateMetadataImport", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async", - "title": "DataprocMetastore exportMetadata Sample", - "origin": "API_DEFINITION", - "description": " Exports metadata from a service.", - "canonical": true, - "file": "dataproc_metastore.export_metadata.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", - "async": true, - "parameters": [ - { - "name": "destination_gcs_folder", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "database_dump_type", - "type": ".google.cloud.metastore.v1beta.DatabaseDumpSpec.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ExportMetadata", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ExportMetadata", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_RestoreService_async", - "title": "DataprocMetastore restoreService Sample", - "origin": "API_DEFINITION", - "description": " Restores a service from a backup.", - "canonical": true, - "file": "dataproc_metastore.restore_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", - "async": true, - "parameters": [ - { - "name": "service", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": "TYPE_STRING" - }, - { - "name": "restore_type", - "type": ".google.cloud.metastore.v1beta.Restore.RestoreType" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "RestoreService", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.RestoreService", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_ListBackups_async", - "title": "DataprocMetastore listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists backups in a service.", - "canonical": true, - "file": "dataproc_metastore.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListBackupsResponse", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.ListBackups", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_GetBackup_async", - "title": "DataprocMetastore getBackup Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single backup.", - "canonical": true, - "file": "dataproc_metastore.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.Backup", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.GetBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_CreateBackup_async", - "title": "DataprocMetastore createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup in a given project and location.", - "canonical": true, - "file": "dataproc_metastore.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup_id", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.metastore.v1beta.Backup" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.CreateBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async", - "title": "DataprocMetastore deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single backup.", - "canonical": true, - "file": "dataproc_metastore.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore.DeleteBackup", - "service": { - "shortName": "DataprocMetastore", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastore" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async", - "title": "DataprocMetastore listFederations Sample", - "origin": "API_DEFINITION", - "description": " Lists federations in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.list_federations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.ListFederationsResponse", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "ListFederations", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.ListFederations", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async", - "title": "DataprocMetastore getFederation Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.get_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.metastore.v1beta.Federation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "GetFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.GetFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async", - "title": "DataprocMetastore createFederation Sample", - "origin": "API_DEFINITION", - "description": " Creates a metastore federation in a project and location.", - "canonical": true, - "file": "dataproc_metastore_federation.create_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "federation_id", - "type": "TYPE_STRING" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1beta.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "CreateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.CreateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async", - "title": "DataprocMetastore updateFederation Sample", - "origin": "API_DEFINITION", - "description": " Updates the fields of a federation.", - "canonical": true, - "file": "dataproc_metastore_federation.update_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "federation", - "type": ".google.cloud.metastore.v1beta.Federation" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "UpdateFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.UpdateFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - }, - { - "regionTag": "metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async", - "title": "DataprocMetastore deleteFederation Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single federation.", - "canonical": true, - "file": "dataproc_metastore_federation.delete_federation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DataprocMetastoreFederationClient", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederationClient" - }, - "method": { - "shortName": "DeleteFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation.DeleteFederation", - "service": { - "shortName": "DataprocMetastoreFederation", - "fullName": "google.cloud.metastore.v1beta.DataprocMetastoreFederation" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts deleted file mode 100644 index d9946ee0feb..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1beta from './v1beta'; -const DataprocMetastoreClient = v1beta.DataprocMetastoreClient; -type DataprocMetastoreClient = v1beta.DataprocMetastoreClient; -const DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; -type DataprocMetastoreFederationClient = v1beta.DataprocMetastoreFederationClient; -export {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -export default {v1beta, DataprocMetastoreClient, DataprocMetastoreFederationClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts deleted file mode 100644 index 3c4a3c0e9a5..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client.ts +++ /dev/null @@ -1,3173 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta/dataproc_metastore_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore services. - * Metastore services are fully managed, highly available, autoscaled, - * autohealing, OSS-native deployments of technical metadata management - * software. Each metastore service exposes a network endpoint through which - * metadata queries are served. Metadata queries can originate from a variety - * of sources, including Apache Hive, Apache Presto, and Apache Spark. - * - * The Dataproc Metastore API defines the following resource model: - * - * * The service works with a collection of Google Cloud projects, named: - * `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * (a location must refer to a Google Cloud `region`) - * * Each location has a collection of services, named: `/services/*` - * * Dataproc Metastore services are resources with names of the form: - * - * `/projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @class - * @memberof v1beta - */ -export class DataprocMetastoreClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DataprocMetastoreClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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 if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - lakePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/lakes/{lake}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listMetadataImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metadataImports'), - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; - const createServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Service') as gax.protobuf.Type; - const updateServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteServiceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const createMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; - const createMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateMetadataImportResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MetadataImport') as gax.protobuf.Type; - const updateMetadataImportMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const exportMetadataResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.MetadataExport') as gax.protobuf.Type; - const exportMetadataMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const restoreServiceResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Restore') as gax.protobuf.Type; - const restoreServiceMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const createBackupResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Backup') as gax.protobuf.Type; - const createBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteBackupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteBackupMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createServiceResponse.decode.bind(createServiceResponse), - createServiceMetadata.decode.bind(createServiceMetadata)), - updateService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateServiceResponse.decode.bind(updateServiceResponse), - updateServiceMetadata.decode.bind(updateServiceMetadata)), - deleteService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteServiceResponse.decode.bind(deleteServiceResponse), - deleteServiceMetadata.decode.bind(deleteServiceMetadata)), - createMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMetadataImportResponse.decode.bind(createMetadataImportResponse), - createMetadataImportMetadata.decode.bind(createMetadataImportMetadata)), - updateMetadataImport: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateMetadataImportResponse.decode.bind(updateMetadataImportResponse), - updateMetadataImportMetadata.decode.bind(updateMetadataImportMetadata)), - exportMetadata: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportMetadataResponse.decode.bind(exportMetadataResponse), - exportMetadataMetadata.decode.bind(exportMetadataMetadata)), - restoreService: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - restoreServiceResponse.decode.bind(restoreServiceResponse), - restoreServiceMetadata.decode.bind(restoreServiceMetadata)), - createBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createBackupResponse.decode.bind(createBackupResponse), - createBackupMetadata.decode.bind(createBackupMetadata)), - deleteBackup: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteBackupResponse.decode.bind(deleteBackupResponse), - deleteBackupMetadata.decode.bind(deleteBackupMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1beta.DataprocMetastore', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.dataprocMetastoreStub) { - return this.dataprocMetastoreStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1beta.DataprocMetastore. - this.dataprocMetastoreStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastore') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastore, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const dataprocMetastoreStubMethods = - ['listServices', 'getService', 'createService', 'updateService', 'deleteService', 'listMetadataImports', 'getMetadataImport', 'createMetadataImport', 'updateMetadataImport', 'exportMetadata', 'restoreService', 'listBackups', 'getBackup', 'createBackup', 'deleteBackup']; - for (const methodName of dataprocMetastoreStubMethods) { - const callPromise = this.dataprocMetastoreStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'metastore.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Service]{@link google.cloud.metastore.v1beta.Service}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.get_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_GetService_async - */ - getService( - request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.cloud.metastore.v1beta.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IService, - protos.google.cloud.metastore.v1beta.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getService(request, options, callback); - } -/** - * Gets details of a single import. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metadata import to retrieve, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.get_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_GetMetadataImport_async - */ - getMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|undefined, {}|undefined - ]>; - getMetadataImport( - request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): void; - getMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport, - protos.google.cloud.metastore.v1beta.IGetMetadataImportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getMetadataImport(request, options, callback); - } -/** - * Gets details of a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to retrieve, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Backup]{@link google.cloud.metastore.v1beta.Backup}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.get_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|undefined, {}|undefined - ]>; - getBackup( - request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; - getBackup( - request?: protos.google.cloud.metastore.v1beta.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup, - protos.google.cloud.metastore.v1beta.IGetBackupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getBackup(request, options, callback); - } - -/** - * Creates a metastore service in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a - * metastore service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.serviceId - * Required. The ID of the metastore service, which is used as the final - * component of the metastore service's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1beta.Service} request.service - * Required. The Metastore service to create. The `name` field is - * ignored. The ID of the created metastore service must be provided in - * the request's `service_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async - */ - createService( - request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createService( - request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.cloud.metastore.v1beta.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateService_async - */ - async checkCreateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore service resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1beta.Service} request.service - * Required. The metastore service to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore service's `name` field is used to identify the metastore - * service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async - */ - updateService( - request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateService( - request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.cloud.metastore.v1beta.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateService_async - */ - async checkUpdateServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore service to delete, in - * the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async - */ - deleteService( - request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.cloud.metastore.v1beta.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteService_async - */ - async checkDeleteServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new MetadataImport in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * metastore import, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.metadataImportId - * Required. The ID of the metadata import, which is used as the final - * component of the metadata import's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport - * Required. The metadata import to create. The `name` field is ignored. The - * ID of the created metadata import must be provided in the request's - * `metadata_import_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async - */ - createMetadataImport( - request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMetadataImport( - request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMetadataImport( - request?: protos.google.cloud.metastore.v1beta.ICreateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateMetadataImport_async - */ - async checkCreateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates a single import. - * Only the description field of MetadataImport is supported to be updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metadata import resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1beta.MetadataImport} request.metadataImport - * Required. The metadata import to update. The server only merges fields - * in the import if they are specified in `update_mask`. - * - * The metadata import's `name` field is used to identify the metastore - * import to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async - */ - updateMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateMetadataImport( - request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateMetadataImport( - request?: protos.google.cloud.metastore.v1beta.IUpdateMetadataImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metadata_import.name': request.metadataImport!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateMetadataImport(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateMetadataImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.update_metadata_import.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_UpdateMetadataImport_async - */ - async checkUpdateMetadataImportProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMetadataImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports metadata from a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.destinationGcsFolder - * A Cloud Storage URI of a folder, in the format - * `gs:///`. A sub-folder - * `` containing exported files will be created below it. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * export, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {google.cloud.metastore.v1beta.DatabaseDumpSpec.Type} [request.databaseDumpType] - * Optional. The type of the database dump. If unspecified, defaults to - * `MYSQL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async - */ - exportMetadata( - request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportMetadata( - request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportMetadata( - request?: protos.google.cloud.metastore.v1beta.IExportMetadataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportMetadata(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportMetadata()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.export_metadata.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ExportMetadata_async - */ - async checkExportMetadataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportMetadata, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Restores a service from a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.service - * Required. The relative resource name of the metastore service to run - * restore, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backup - * Required. The relative resource name of the metastore service backup to - * restore from, in the following form: - * - * `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {google.cloud.metastore.v1beta.Restore.RestoreType} [request.restoreType] - * Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async - */ - restoreService( - request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - restoreService( - request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - restoreService( - request?: protos.google.cloud.metastore.v1beta.IRestoreServiceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service': request.service ?? '', - }); - this.initialize(); - return this.innerApiCalls.restoreService(request, options, callback); - } -/** - * Check the status of the long running operation returned by `restoreService()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.restore_service.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_RestoreService_async - */ - async checkRestoreServiceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreService, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new backup in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service in which to create a - * backup of the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}`. - * @param {string} request.backupId - * Required. The ID of the backup, which is used as the final component of the - * backup's name. - * - * This value must be between 1 and 64 characters long, begin with a letter, - * end with a letter or number, and consist of alpha-numeric ASCII characters - * or hyphens. - * @param {google.cloud.metastore.v1beta.Backup} request.backup - * Required. The backup to create. The `name` field is ignored. The ID of the - * created backup must be provided in the request's `backup_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createBackup( - request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createBackup( - request?: protos.google.cloud.metastore.v1beta.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.create_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_CreateBackup_async - */ - async checkCreateBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the backup to delete, in the - * following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to - * ignore the request if it has completed. The server will ignore subsequent - * requests that provide a duplicate request ID for at least 60 minutes after - * the first request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteBackup( - request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteBackup( - request?: protos.google.cloud.metastore.v1beta.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteBackup(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteBackup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.delete_backup.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_DeleteBackup_async - */ - async checkDeleteBackupProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteBackup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists services in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Service]{@link google.cloud.metastore.v1beta.Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listServices( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IService[], - protos.google.cloud.metastore.v1beta.IListServicesRequest|null, - protos.google.cloud.metastore.v1beta.IListServicesResponse - ]>; - listServices( - request: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>): void; - listServices( - request: protos.google.cloud.metastore.v1beta.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>): void; - listServices( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListServicesRequest, - protos.google.cloud.metastore.v1beta.IListServicesResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IService>): - Promise<[ - protos.google.cloud.metastore.v1beta.IService[], - protos.google.cloud.metastore.v1beta.IListServicesRequest|null, - protos.google.cloud.metastore.v1beta.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listServices(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Service]{@link google.cloud.metastore.v1beta.Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listServicesStream( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore services - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of services to return. The response may - * contain less than the maximum number. If unspecified, no more than 500 - * services are returned. The maximum value is 1000; values above 1000 are - * changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Service]{@link google.cloud.metastore.v1beta.Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.list_services.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ListServices_async - */ - listServicesAsync( - request?: protos.google.cloud.metastore.v1beta.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists imports in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMetadataImports( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport[], - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse - ]>; - listMetadataImports( - request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>): void; - listMetadataImports( - request: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>): void; - listMetadataImports( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IMetadataImport>): - Promise<[ - protos.google.cloud.metastore.v1beta.IMetadataImport[], - protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest|null, - protos.google.cloud.metastore.v1beta.IListMetadataImportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listMetadataImports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMetadataImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listMetadataImportsStream( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.createStream( - this.innerApiCalls.listMetadataImports as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetadataImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose metadata imports - * to list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports`. - * @param {number} [request.pageSize] - * Optional. The maximum number of imports to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 imports are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListServices|DataprocMetastore.ListServices} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [MetadataImport]{@link google.cloud.metastore.v1beta.MetadataImport}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.list_metadata_imports.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ListMetadataImports_async - */ - listMetadataImportsAsync( - request?: protos.google.cloud.metastore.v1beta.IListMetadataImportsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMetadataImports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMetadataImports.asyncIterate( - this.innerApiCalls['listMetadataImports'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists backups in a service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Backup]{@link google.cloud.metastore.v1beta.Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup[], - protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, - protos.google.cloud.metastore.v1beta.IListBackupsResponse - ]>; - listBackups( - request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>): void; - listBackups( - request: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>): void; - listBackups( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListBackupsRequest, - protos.google.cloud.metastore.v1beta.IListBackupsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IBackup>): - Promise<[ - protos.google.cloud.metastore.v1beta.IBackup[], - protos.google.cloud.metastore.v1beta.IListBackupsRequest|null, - protos.google.cloud.metastore.v1beta.IListBackupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listBackups(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Backup]{@link google.cloud.metastore.v1beta.Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the service whose backups to - * list, in the following form: - * - * `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`. - * @param {number} [request.pageSize] - * Optional. The maximum number of backups to return. The response may contain - * less than the maximum number. If unspecified, no more than 500 backups are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * {@link google.cloud.metastore.v1beta.DataprocMetastore.ListBackups|DataprocMetastore.ListBackups} - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Backup]{@link google.cloud.metastore.v1beta.Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore.list_backups.js - * region_tag:metastore_v1beta_generated_DataprocMetastore_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.metastore.v1beta.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * 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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified lake resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} lake - * @returns {string} Resource name string. - */ - lakePath(project:string,location:string,lake:string) { - return this.pathTemplates.lakePathTemplate.render({ - project: project, - location: location, - lake: lake, - }); - } - - /** - * Parse the project from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).project; - } - - /** - * Parse the location from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).location; - } - - /** - * Parse the lake from Lake resource. - * - * @param {string} lakeName - * A fully-qualified path representing Lake resource. - * @returns {string} A string representing the lake. - */ - matchLakeFromLakeName(lakeName: string) { - return this.pathTemplates.lakePathTemplate.match(lakeName).lake; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project:string,network:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dataprocMetastoreStub && !this._terminated) { - return this.dataprocMetastoreStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json deleted file mode 100644 index 0a770678945..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_client_config.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1beta.DataprocMetastore": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListServices": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetService": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetadataImports": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMetadataImport": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportMetadata": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreService": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts deleted file mode 100644 index dab59f4908f..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client.ts +++ /dev/null @@ -1,1725 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta/dataproc_metastore_federation_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataproc_metastore_federation_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages metastore federation services. - * Dataproc Metastore Federation Service allows federating a collection of - * backend metastores like BigQuery, Dataplex Lakes, and other Dataproc - * Metastores. The Federation Service exposes a gRPC URL through which metadata - * from the backend metastores are served at query time. - * - * The Dataproc Metastore Federation API defines the following resource model: - * * The service works with a collection of Google Cloud projects. - * * Each project has a collection of available locations. - * * Each location has a collection of federations. - * * Dataproc Metastore Federations are resources with names of the - * form: - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @class - * @memberof v1beta - */ -export class DataprocMetastoreFederationClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - dataprocMetastoreFederationStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DataprocMetastoreFederationClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DataprocMetastoreFederationClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DataprocMetastoreFederationClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // 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 if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/backups/{backup}' - ), - federationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/federations/{federation}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - metadataImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}/metadataImports/{metadata_import}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - servicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/services/{service}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listFederations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'federations') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta/{resource=projects/*/locations/*/services/*}:getIamPolicy',additional_bindings: [{get: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:getIamPolicy',},{get: '/v1beta/{resource=projects/*/locations/*/federations/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta/{resource=projects/*/locations/*/services/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:setIamPolicy',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta/{resource=projects/*/locations/*/services/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta/{resource=projects/*/locations/*/services/*/backups/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/services/*/databases/*/tables/*}:testIamPermissions',body: '*',},{post: '/v1beta/{resource=projects/*/locations/*/federations/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; - const createFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const updateFederationResponse = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.Federation') as gax.protobuf.Type; - const updateFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - const deleteFederationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteFederationMetadata = protoFilesRoot.lookup( - '.google.cloud.metastore.v1beta.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createFederationResponse.decode.bind(createFederationResponse), - createFederationMetadata.decode.bind(createFederationMetadata)), - updateFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateFederationResponse.decode.bind(updateFederationResponse), - updateFederationMetadata.decode.bind(updateFederationMetadata)), - deleteFederation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteFederationResponse.decode.bind(deleteFederationResponse), - deleteFederationMetadata.decode.bind(deleteFederationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.metastore.v1beta.DataprocMetastoreFederation', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.dataprocMetastoreFederationStub) { - return this.dataprocMetastoreFederationStub; - } - - // Put together the "service stub" for - // google.cloud.metastore.v1beta.DataprocMetastoreFederation. - this.dataprocMetastoreFederationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.metastore.v1beta.DataprocMetastoreFederation') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.metastore.v1beta.DataprocMetastoreFederation, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const dataprocMetastoreFederationStubMethods = - ['listFederations', 'getFederation', 'createFederation', 'updateFederation', 'deleteFederation']; - for (const methodName of dataprocMetastoreFederationStubMethods) { - const callPromise = this.dataprocMetastoreFederationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.dataprocMetastoreFederationStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'metastore.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'metastore.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to retrieve, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Federation]{@link google.cloud.metastore.v1beta.Federation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.get_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_GetFederation_async - */ - getFederation( - request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|undefined, {}|undefined - ]>; - getFederation( - request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - callback: Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>): void; - getFederation( - request?: protos.google.cloud.metastore.v1beta.IGetFederationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation, - protos.google.cloud.metastore.v1beta.IGetFederationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFederation(request, options, callback); - } - -/** - * Creates a metastore federation in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location in which to create a federation - * service, in the following form: - * - * `projects/{project_number}/locations/{location_id}`. - * @param {string} request.federationId - * Required. The ID of the metastore federation, which is used as the final - * component of the metastore federation's name. - * - * This value must be between 2 and 63 characters long inclusive, begin with a - * letter, end with a letter or number, and consist of alpha-numeric - * ASCII characters or hyphens. - * @param {google.cloud.metastore.v1beta.Federation} request.federation - * Required. The Metastore Federation to create. The `name` field is - * ignored. The ID of the created metastore federation must be - * provided in the request's `federation_id` field. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async - */ - createFederation( - request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createFederation( - request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createFederation( - request?: protos.google.cloud.metastore.v1beta.ICreateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.create_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_CreateFederation_async - */ - async checkCreateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the fields of a federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A field mask used to specify the fields to be overwritten in the - * metastore federation resource by the update. - * Fields specified in the `update_mask` are relative to the resource (not - * to the full request). A field is overwritten if it is in the mask. - * @param {google.cloud.metastore.v1beta.Federation} request.federation - * Required. The metastore federation to update. The server only merges fields - * in the service if they are specified in `update_mask`. - * - * The metastore federation's `name` field is used to identify the - * metastore service to be updated. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - updateFederation( - request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateFederation( - request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateFederation( - request?: protos.google.cloud.metastore.v1beta.IUpdateFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'federation.name': request.federation!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.update_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_UpdateFederation_async - */ - async checkUpdateFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single federation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the metastore federation to delete, - * in the following form: - * - * `projects/{project_number}/locations/{location_id}/federations/{federation_id}`. - * @param {string} [request.requestId] - * Optional. A request ID. Specify a unique request ID to allow the server to ignore the - * request if it has completed. The server will ignore subsequent requests - * that provide a duplicate request ID for at least 60 minutes after the first - * request. - * - * For example, if an initial request times out, followed by another request - * with the same request ID, the server ignores the second request to prevent - * the creation of duplicate commitments. - * - * The request ID must be a valid - * [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) - * A zero UUID (00000000-0000-0000-0000-000000000000) is not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - deleteFederation( - request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteFederation( - request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteFederation( - request?: protos.google.cloud.metastore.v1beta.IDeleteFederationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFederation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteFederation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.delete_federation.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_DeleteFederation_async - */ - async checkDeleteFederationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteFederation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists federations in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Federation]{@link google.cloud.metastore.v1beta.Federation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFederations( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation[], - protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, - protos.google.cloud.metastore.v1beta.IListFederationsResponse - ]>; - listFederations( - request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>): void; - listFederations( - request: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - callback: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>): void; - listFederations( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>, - callback?: PaginationCallback< - protos.google.cloud.metastore.v1beta.IListFederationsRequest, - protos.google.cloud.metastore.v1beta.IListFederationsResponse|null|undefined, - protos.google.cloud.metastore.v1beta.IFederation>): - Promise<[ - protos.google.cloud.metastore.v1beta.IFederation[], - protos.google.cloud.metastore.v1beta.IListFederationsRequest|null, - protos.google.cloud.metastore.v1beta.IListFederationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFederations(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Federation]{@link google.cloud.metastore.v1beta.Federation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFederationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listFederationsStream( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.createStream( - this.innerApiCalls.listFederations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFederations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative resource name of the location of metastore federations - * to list, in the following form: - * `projects/{project_number}/locations/{location_id}`. - * @param {number} [request.pageSize] - * Optional. The maximum number of federations to return. The response may contain less - * than the maximum number. If unspecified, no more than 500 services are - * returned. The maximum value is 1000; values above 1000 are changed to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous ListFederationServices - * call. Provide this token to retrieve the subsequent page. - * - * To retrieve the first page, supply an empty page token. - * - * When paginating, other parameters provided to - * ListFederationServices must match the call that provided the - * page token. - * @param {string} [request.filter] - * Optional. The filter to apply to list results. - * @param {string} [request.orderBy] - * Optional. Specify the ordering of results as described in [Sorting - * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). - * If not specified, the results will be sorted in the default order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Federation]{@link google.cloud.metastore.v1beta.Federation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta/dataproc_metastore_federation.list_federations.js - * region_tag:metastore_v1beta_generated_DataprocMetastoreFederation_ListFederations_async - */ - listFederationsAsync( - request?: protos.google.cloud.metastore.v1beta.IListFederationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listFederations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFederations.asyncIterate( - this.innerApiCalls['listFederations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * 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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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. - * - * @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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#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 [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project:string,location:string,service:string,backup:string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - service: service, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the service from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the service. - */ - matchServiceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).service; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified federation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} federation - * @returns {string} Resource name string. - */ - federationPath(project:string,location:string,federation:string) { - return this.pathTemplates.federationPathTemplate.render({ - project: project, - location: location, - federation: federation, - }); - } - - /** - * Parse the project from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).project; - } - - /** - * Parse the location from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).location; - } - - /** - * Parse the federation from Federation resource. - * - * @param {string} federationName - * A fully-qualified path representing Federation resource. - * @returns {string} A string representing the federation. - */ - matchFederationFromFederationName(federationName: string) { - return this.pathTemplates.federationPathTemplate.match(federationName).federation; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified metadataImport resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @param {string} metadata_import - * @returns {string} Resource name string. - */ - metadataImportPath(project:string,location:string,service:string,metadataImport:string) { - return this.pathTemplates.metadataImportPathTemplate.render({ - project: project, - location: location, - service: service, - metadata_import: metadataImport, - }); - } - - /** - * Parse the project from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).project; - } - - /** - * Parse the location from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).location; - } - - /** - * Parse the service from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the service. - */ - matchServiceFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).service; - } - - /** - * Parse the metadata_import from MetadataImport resource. - * - * @param {string} metadataImportName - * A fully-qualified path representing MetadataImport resource. - * @returns {string} A string representing the metadata_import. - */ - matchMetadataImportFromMetadataImportName(metadataImportName: string) { - return this.pathTemplates.metadataImportPathTemplate.match(metadataImportName).metadata_import; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified service resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} service - * @returns {string} Resource name string. - */ - servicePath(project:string,location:string,service:string) { - return this.pathTemplates.servicePathTemplate.render({ - project: project, - location: location, - service: service, - }); - } - - /** - * Parse the project from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).project; - } - - /** - * Parse the location from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).location; - } - - /** - * Parse the service from Service resource. - * - * @param {string} serviceName - * A fully-qualified path representing Service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromServiceName(serviceName: string) { - return this.pathTemplates.servicePathTemplate.match(serviceName).service; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dataprocMetastoreFederationStub && !this._terminated) { - return this.dataprocMetastoreFederationStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json deleted file mode 100644 index e6e1944d917..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.metastore.v1beta.DataprocMetastoreFederation": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListFederations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFederation": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json deleted file mode 100644 index aaeb52eb5c3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_federation_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1beta/metastore.proto", - "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json deleted file mode 100644 index aaeb52eb5c3..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/dataproc_metastore_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/metastore/v1beta/metastore.proto", - "../../protos/google/cloud/metastore/v1beta/metastore_federation.proto" -] diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index fdbbd5e20ca..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.metastore.v1beta", - "libraryPackage": "@google-cloud/dataproc-metastore", - "services": { - "DataprocMetastore": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreClient", - "rpcs": { - "GetService": { - "methods": [ - "getService" - ] - }, - "GetMetadataImport": { - "methods": [ - "getMetadataImport" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "CreateService": { - "methods": [ - "createService" - ] - }, - "UpdateService": { - "methods": [ - "updateService" - ] - }, - "DeleteService": { - "methods": [ - "deleteService" - ] - }, - "CreateMetadataImport": { - "methods": [ - "createMetadataImport" - ] - }, - "UpdateMetadataImport": { - "methods": [ - "updateMetadataImport" - ] - }, - "ExportMetadata": { - "methods": [ - "exportMetadata" - ] - }, - "RestoreService": { - "methods": [ - "restoreService" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListServices": { - "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" - ] - }, - "ListMetadataImports": { - "methods": [ - "listMetadataImports", - "listMetadataImportsStream", - "listMetadataImportsAsync" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "DataprocMetastoreFederation": { - "clients": { - "grpc": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DataprocMetastoreFederationClient", - "rpcs": { - "GetFederation": { - "methods": [ - "getFederation" - ] - }, - "CreateFederation": { - "methods": [ - "createFederation" - ] - }, - "UpdateFederation": { - "methods": [ - "updateFederation" - ] - }, - "DeleteFederation": { - "methods": [ - "deleteFederation" - ] - }, - "ListFederations": { - "methods": [ - "listFederations", - "listFederationsStream", - "listFederationsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts deleted file mode 100644 index 3e1ee876b29..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/src/v1beta/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {DataprocMetastoreClient} from './dataproc_metastore_client'; -export {DataprocMetastoreFederationClient} from './dataproc_metastore_federation_client'; diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 74e7a6657af..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const metastore = require('@google-cloud/dataproc-metastore'); - -function main() { - const dataprocMetastoreClient = new metastore.DataprocMetastoreClient(); - const dataprocMetastoreFederationClient = new metastore.DataprocMetastoreFederationClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index f10cef1cd2c..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {DataprocMetastoreClient, DataprocMetastoreFederationClient} from '@google-cloud/dataproc-metastore'; - -// check that the client class type name can be used -function doStuffWithDataprocMetastoreClient(client: DataprocMetastoreClient) { - client.close(); -} -function doStuffWithDataprocMetastoreFederationClient(client: DataprocMetastoreFederationClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dataprocMetastoreClient = new DataprocMetastoreClient(); - doStuffWithDataprocMetastoreClient(dataprocMetastoreClient); - // check that the client instance can be created - const dataprocMetastoreFederationClient = new DataprocMetastoreFederationClient(); - doStuffWithDataprocMetastoreFederationClient(dataprocMetastoreFederationClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts b/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts deleted file mode 100644 index 2fc7477b5b6..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_federation_v1beta.ts +++ /dev/null @@ -1,2000 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dataprocmetastorefederationModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta.DataprocMetastoreFederationClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreFederationStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreFederationStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreFederationStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getFederation', () => { - it('invokes getFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCall(expectedResponse); - const [response] = await client.getFederation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Federation() - ); - client.innerApiCalls.getFederation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFederation( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFederation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFederation with closed client', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetFederationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFederation(request), expectedError); - }); - }); - - describe('createFederation', () => { - it('invokes createFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateFederationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateFederation', () => { - it('invokes updateFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateFederationRequest() - ); - request.federation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateFederationRequest', ['federation', 'name']); - request.federation.name = defaultValue1; - const expectedHeaderRequestParams = `federation.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteFederation', () => { - it('invokes deleteFederation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFederation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteFederation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFederation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with call error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFederation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFederation with LRO error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteFederationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteFederationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFederation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFederation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFederation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteFederationProgress without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteFederationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteFederationProgress with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFederationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listFederations', () => { - it('invokes listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCall(expectedResponse); - const [response] = await client.listFederations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.innerApiCalls.listFederations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFederations( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IFederation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFederations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFederations(request), expectedError); - const actualRequest = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFederations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFederationsStream without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFederationsStream with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFederationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Federation[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Federation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFederations, request)); - assert( - (client.descriptors.page.listFederations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Federation()), - ]; - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; - const iterable = client.listFederationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFederations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListFederationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListFederationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listFederations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFederationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IFederation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFederations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastorefederationModule.v1beta.DataprocMetastoreFederationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts b/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts deleted file mode 100644 index 7de65156fdc..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/test/gapic_dataproc_metastore_v1beta.ts +++ /dev/null @@ -1,3718 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dataprocmetastoreModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta.DataprocMetastoreClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = dataprocmetastoreModule.v1beta.DataprocMetastoreClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - await client.initialize(); - assert(client.dataprocMetastoreStub); - }); - - it('has close method for the initialized client', done => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.dataprocMetastoreStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataprocMetastoreStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getService', () => { - it('invokes getService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('getMetadataImport', () => { - it('invokes getMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCall(expectedResponse); - const [response] = await client.getMetadataImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.MetadataImport() - ); - client.innerApiCalls.getMetadataImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetadataImport( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetadataImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetadataImport with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetMetadataImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMetadataImport(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCall(expectedResponse); - const [operation] = await client.createService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createMetadataImport', () => { - it('invokes createMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateMetadataImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateMetadataImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateMetadataImport', () => { - it('invokes updateMetadataImport without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMetadataImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMetadataImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMetadataImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMetadataImport(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateMetadataImport with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.UpdateMetadataImportRequest() - ); - request.metadataImport ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.UpdateMetadataImportRequest', ['metadataImport', 'name']); - request.metadataImport.name = defaultValue1; - const expectedHeaderRequestParams = `metadata_import.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMetadataImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMetadataImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMetadataImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateMetadataImportProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMetadataImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateMetadataImportProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMetadataImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportMetadata', () => { - it('invokes exportMetadata without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportMetadata(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportMetadata = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportMetadata( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportMetadata(request), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportMetadata with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ExportMetadataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ExportMetadataRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportMetadata = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportMetadata(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportMetadata as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportMetadataProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportMetadataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportMetadataProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportMetadataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('restoreService', () => { - it('invokes restoreService without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCall(expectedResponse); - const [operation] = await client.restoreService(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.restoreService = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreService( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreService(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreService with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.RestoreServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.RestoreServiceRequest', ['service']); - request.service = defaultValue1; - const expectedHeaderRequestParams = `service=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreService = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreService(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRestoreServiceProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRestoreServiceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRestoreServiceProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRestoreServiceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteBackup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteBackup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with call error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with LRO error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteBackup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteBackupProgress without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteBackupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteBackupProgress with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteBackupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Service[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetadataImports', () => { - it('invokes listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCall(expectedResponse); - const [response] = await client.listMetadataImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.innerApiCalls.listMetadataImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetadataImports( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IMetadataImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetadataImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetadataImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetadataImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetadataImportsStream without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetadataImportsStream with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetadataImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.MetadataImport[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.MetadataImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetadataImports, request)); - assert( - (client.descriptors.page.listMetadataImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.MetadataImport()), - ]; - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; - const iterable = client.listMetadataImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetadataImports with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListMetadataImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListMetadataImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetadataImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetadataImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IMetadataImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetadataImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.metastore.v1beta.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.metastore.v1beta.Backup[] = []; - stream.on('data', (response: protos.google.cloud.metastore.v1beta.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - generateSampleMessage(new protos.google.cloud.metastore.v1beta.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.metastore.v1beta.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.metastore.v1beta.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.metastore.v1beta.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('backup', () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - backup: "backupValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "serviceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromBackupName', () => { - const result = client.matchServiceFromBackupName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('federation', () => { - const fakePath = "/rendered/path/federation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - federation: "federationValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.federationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.federationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('federationPath', () => { - const result = client.federationPath("projectValue", "locationValue", "federationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.federationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFederationName', () => { - const result = client.matchProjectFromFederationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFederationName', () => { - const result = client.matchLocationFromFederationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFederationFromFederationName', () => { - const result = client.matchFederationFromFederationName(fakePath); - assert.strictEqual(result, "federationValue"); - assert((client.pathTemplates.federationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('lake', () => { - const fakePath = "/rendered/path/lake"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - lake: "lakeValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.lakePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.lakePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('lakePath', () => { - const result = client.lakePath("projectValue", "locationValue", "lakeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.lakePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLakeName', () => { - const result = client.matchProjectFromLakeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLakeName', () => { - const result = client.matchLocationFromLakeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLakeFromLakeName', () => { - const result = client.matchLakeFromLakeName(fakePath); - assert.strictEqual(result, "lakeValue"); - assert((client.pathTemplates.lakePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('metadataImport', () => { - const fakePath = "/rendered/path/metadataImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - metadata_import: "metadataImportValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.metadataImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.metadataImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('metadataImportPath', () => { - const result = client.metadataImportPath("projectValue", "locationValue", "serviceValue", "metadataImportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.metadataImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMetadataImportName', () => { - const result = client.matchProjectFromMetadataImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMetadataImportName', () => { - const result = client.matchLocationFromMetadataImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromMetadataImportName', () => { - const result = client.matchServiceFromMetadataImportName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetadataImportFromMetadataImportName', () => { - const result = client.matchMetadataImportFromMetadataImportName(fakePath); - assert.strictEqual(result, "metadataImportValue"); - assert((client.pathTemplates.metadataImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - service: "serviceValue", - }; - const client = new dataprocmetastoreModule.v1beta.DataprocMetastoreClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePath', () => { - const result = client.servicePath("projectValue", "locationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceName', () => { - const result = client.matchProjectFromServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServiceName', () => { - const result = client.matchLocationFromServiceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json b/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js b/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js deleted file mode 100644 index 6fc45cb3d30..00000000000 --- a/owl-bot-staging/google-cloud-metastore/v1beta/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DataprocMetastore', - filename: './dataproc-metastore.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/packages/google-cloud-metastore/protos/google/cloud/metastore/v1beta/metastore.proto b/packages/google-cloud-metastore/protos/google/cloud/metastore/v1beta/metastore.proto index 7d763e35b8d..6259c124165 100644 --- a/packages/google-cloud-metastore/protos/google/cloud/metastore/v1beta/metastore.proto +++ b/packages/google-cloud-metastore/protos/google/cloud/metastore/v1beta/metastore.proto @@ -572,7 +572,7 @@ message NetworkConfig { // be at least one IP address available in the subnet's primary range. The // subnet is specified in the following form: // - // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id} + // `projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}` string subnetwork = 1 [ (google.api.field_behavior) = IMMUTABLE, (google.api.resource_reference) = {