diff --git a/packages/google-cloud-kms/README.md b/packages/google-cloud-kms/README.md index bbc177b40bc..60ae79116d5 100644 --- a/packages/google-cloud-kms/README.md +++ b/packages/google-cloud-kms/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Google Cloud Key Management Service: Node.js Client](https://github.com/googleapis/google-cloud-node) +# [Google Cloud Key Management Service: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-kms) [![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/kms.svg)](https://www.npmjs.org/package/@google-cloud/kms) @@ -92,44 +92,44 @@ return listKeyRings(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-kms/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Ekm_service.create_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js,samples/README.md) | -| Ekm_service.get_ekm_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_config.js,samples/README.md) | -| Ekm_service.get_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js,samples/README.md) | -| Ekm_service.list_ekm_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js,samples/README.md) | -| Ekm_service.update_ekm_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_config.js,samples/README.md) | -| Ekm_service.update_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js,samples/README.md) | -| Key_management_service.asymmetric_decrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js,samples/README.md) | -| Key_management_service.asymmetric_sign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js,samples/README.md) | -| Key_management_service.create_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js,samples/README.md) | -| Key_management_service.create_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js,samples/README.md) | -| Key_management_service.create_import_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js,samples/README.md) | -| Key_management_service.create_key_ring | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js,samples/README.md) | -| Key_management_service.decrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js,samples/README.md) | -| Key_management_service.destroy_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js,samples/README.md) | -| Key_management_service.encrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js,samples/README.md) | -| Key_management_service.generate_random_bytes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js,samples/README.md) | -| Key_management_service.get_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js,samples/README.md) | -| Key_management_service.get_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js,samples/README.md) | -| Key_management_service.get_import_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js,samples/README.md) | -| Key_management_service.get_key_ring | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js,samples/README.md) | -| Key_management_service.get_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js,samples/README.md) | -| Key_management_service.import_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js,samples/README.md) | -| Key_management_service.list_crypto_key_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js,samples/README.md) | -| Key_management_service.list_crypto_keys | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js,samples/README.md) | -| Key_management_service.list_import_jobs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js,samples/README.md) | -| Key_management_service.list_key_rings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js,samples/README.md) | -| Key_management_service.mac_sign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js,samples/README.md) | -| Key_management_service.mac_verify | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js,samples/README.md) | -| Key_management_service.restore_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js,samples/README.md) | -| Key_management_service.update_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js,samples/README.md) | -| Key_management_service.update_crypto_key_primary_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js,samples/README.md) | -| Key_management_service.update_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/quickstart.js,samples/README.md) | -| Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/test/quickstart.test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/test/quickstart.test.js,samples/README.md) | +| Ekm_service.create_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js,packages/google-cloud-kms/samples/README.md) | +| Ekm_service.get_ekm_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_config.js,packages/google-cloud-kms/samples/README.md) | +| Ekm_service.get_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js,packages/google-cloud-kms/samples/README.md) | +| Ekm_service.list_ekm_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js,packages/google-cloud-kms/samples/README.md) | +| Ekm_service.update_ekm_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_config.js,packages/google-cloud-kms/samples/README.md) | +| Ekm_service.update_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js,packages/google-cloud-kms/samples/README.md) | +| Ekm_service.verify_connectivity | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.asymmetric_decrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.asymmetric_sign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.create_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.create_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.create_import_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.create_key_ring | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.decrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.destroy_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.encrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.generate_random_bytes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.get_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.get_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.get_import_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.get_key_ring | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.get_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.import_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.list_crypto_key_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.list_crypto_keys | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.list_import_jobs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.list_key_rings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.mac_sign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.mac_verify | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.restore_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.update_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.update_crypto_key_primary_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js,packages/google-cloud-kms/samples/README.md) | +| Key_management_service.update_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js,packages/google-cloud-kms/samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/quickstart.js,packages/google-cloud-kms/samples/README.md) | diff --git a/packages/google-cloud-kms/protos/google/cloud/kms/v1/ekm_service.proto b/packages/google-cloud-kms/protos/google/cloud/kms/v1/ekm_service.proto index b63b55ec72e..51e2fceecc8 100644 --- a/packages/google-cloud-kms/protos/google/cloud/kms/v1/ekm_service.proto +++ b/packages/google-cloud-kms/protos/google/cloud/kms/v1/ekm_service.proto @@ -102,6 +102,19 @@ service EkmService { }; option (google.api.method_signature) = "ekm_config,update_mask"; } + + // Verifies that Cloud KMS can successfully connect to the external key + // manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. + // If there is an error connecting to the EKM, this method returns a + // FAILED_PRECONDITION status containing structured information as described + // at https://cloud.google.com/kms/docs/reference/ekm_errors. + rpc VerifyConnectivity(VerifyConnectivityRequest) + returns (VerifyConnectivityResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/ekmConnections/*}:verifyConnectivity" + }; + option (google.api.method_signature) = "name"; + } } // Request message for @@ -419,3 +432,20 @@ message EkmConfig { } ]; } + +// Request message for +// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity]. +message VerifyConnectivityRequest { + // Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConnection" + } + ]; +} + +// Response message for +// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity]. +message VerifyConnectivityResponse {} \ No newline at end of file diff --git a/packages/google-cloud-kms/protos/protos.d.ts b/packages/google-cloud-kms/protos/protos.d.ts index 949eeb93678..8960a333faf 100644 --- a/packages/google-cloud-kms/protos/protos.d.ts +++ b/packages/google-cloud-kms/protos/protos.d.ts @@ -129,6 +129,20 @@ export namespace google { * @returns Promise */ public updateEkmConfig(request: google.cloud.kms.v1.IUpdateEkmConfigRequest): Promise; + + /** + * Calls VerifyConnectivity. + * @param request VerifyConnectivityRequest message or plain object + * @param callback Node-style callback called with the error, if any, and VerifyConnectivityResponse + */ + public verifyConnectivity(request: google.cloud.kms.v1.IVerifyConnectivityRequest, callback: google.cloud.kms.v1.EkmService.VerifyConnectivityCallback): void; + + /** + * Calls VerifyConnectivity. + * @param request VerifyConnectivityRequest message or plain object + * @returns Promise + */ + public verifyConnectivity(request: google.cloud.kms.v1.IVerifyConnectivityRequest): Promise; } namespace EkmService { @@ -174,6 +188,13 @@ export namespace google { * @param [response] EkmConfig */ type UpdateEkmConfigCallback = (error: (Error|null), response?: google.cloud.kms.v1.EkmConfig) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|verifyConnectivity}. + * @param error Error, if any + * @param [response] VerifyConnectivityResponse + */ + type VerifyConnectivityCallback = (error: (Error|null), response?: google.cloud.kms.v1.VerifyConnectivityResponse) => void; } /** Properties of a ListEkmConnectionsRequest. */ @@ -1415,6 +1436,194 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a VerifyConnectivityRequest. */ + interface IVerifyConnectivityRequest { + + /** VerifyConnectivityRequest name */ + name?: (string|null); + } + + /** Represents a VerifyConnectivityRequest. */ + class VerifyConnectivityRequest implements IVerifyConnectivityRequest { + + /** + * Constructs a new VerifyConnectivityRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IVerifyConnectivityRequest); + + /** VerifyConnectivityRequest name. */ + public name: string; + + /** + * Creates a new VerifyConnectivityRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns VerifyConnectivityRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IVerifyConnectivityRequest): google.cloud.kms.v1.VerifyConnectivityRequest; + + /** + * Encodes the specified VerifyConnectivityRequest message. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityRequest.verify|verify} messages. + * @param message VerifyConnectivityRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IVerifyConnectivityRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VerifyConnectivityRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityRequest.verify|verify} messages. + * @param message VerifyConnectivityRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IVerifyConnectivityRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VerifyConnectivityRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VerifyConnectivityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.VerifyConnectivityRequest; + + /** + * Decodes a VerifyConnectivityRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VerifyConnectivityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.VerifyConnectivityRequest; + + /** + * Verifies a VerifyConnectivityRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VerifyConnectivityRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VerifyConnectivityRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.VerifyConnectivityRequest; + + /** + * Creates a plain object from a VerifyConnectivityRequest message. Also converts values to other types if specified. + * @param message VerifyConnectivityRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.VerifyConnectivityRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VerifyConnectivityRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VerifyConnectivityRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a VerifyConnectivityResponse. */ + interface IVerifyConnectivityResponse { + } + + /** Represents a VerifyConnectivityResponse. */ + class VerifyConnectivityResponse implements IVerifyConnectivityResponse { + + /** + * Constructs a new VerifyConnectivityResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IVerifyConnectivityResponse); + + /** + * Creates a new VerifyConnectivityResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns VerifyConnectivityResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IVerifyConnectivityResponse): google.cloud.kms.v1.VerifyConnectivityResponse; + + /** + * Encodes the specified VerifyConnectivityResponse message. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityResponse.verify|verify} messages. + * @param message VerifyConnectivityResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IVerifyConnectivityResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VerifyConnectivityResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityResponse.verify|verify} messages. + * @param message VerifyConnectivityResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IVerifyConnectivityResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VerifyConnectivityResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VerifyConnectivityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.VerifyConnectivityResponse; + + /** + * Decodes a VerifyConnectivityResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VerifyConnectivityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.VerifyConnectivityResponse; + + /** + * Verifies a VerifyConnectivityResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VerifyConnectivityResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VerifyConnectivityResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.VerifyConnectivityResponse; + + /** + * Creates a plain object from a VerifyConnectivityResponse message. Also converts values to other types if specified. + * @param message VerifyConnectivityResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.VerifyConnectivityResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VerifyConnectivityResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VerifyConnectivityResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a KeyRing. */ interface IKeyRing { diff --git a/packages/google-cloud-kms/protos/protos.js b/packages/google-cloud-kms/protos/protos.js index da1e3741c07..edef078f928 100644 --- a/packages/google-cloud-kms/protos/protos.js +++ b/packages/google-cloud-kms/protos/protos.js @@ -296,6 +296,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|verifyConnectivity}. + * @memberof google.cloud.kms.v1.EkmService + * @typedef VerifyConnectivityCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.VerifyConnectivityResponse} [response] VerifyConnectivityResponse + */ + + /** + * Calls VerifyConnectivity. + * @function verifyConnectivity + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IVerifyConnectivityRequest} request VerifyConnectivityRequest message or plain object + * @param {google.cloud.kms.v1.EkmService.VerifyConnectivityCallback} callback Node-style callback called with the error, if any, and VerifyConnectivityResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EkmService.prototype.verifyConnectivity = function verifyConnectivity(request, callback) { + return this.rpcCall(verifyConnectivity, $root.google.cloud.kms.v1.VerifyConnectivityRequest, $root.google.cloud.kms.v1.VerifyConnectivityResponse, request, callback); + }, "name", { value: "VerifyConnectivity" }); + + /** + * Calls VerifyConnectivity. + * @function verifyConnectivity + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IVerifyConnectivityRequest} request VerifyConnectivityRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return EkmService; })(); @@ -3334,6 +3367,384 @@ return EkmConfig; })(); + v1.VerifyConnectivityRequest = (function() { + + /** + * Properties of a VerifyConnectivityRequest. + * @memberof google.cloud.kms.v1 + * @interface IVerifyConnectivityRequest + * @property {string|null} [name] VerifyConnectivityRequest name + */ + + /** + * Constructs a new VerifyConnectivityRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a VerifyConnectivityRequest. + * @implements IVerifyConnectivityRequest + * @constructor + * @param {google.cloud.kms.v1.IVerifyConnectivityRequest=} [properties] Properties to set + */ + function VerifyConnectivityRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VerifyConnectivityRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @instance + */ + VerifyConnectivityRequest.prototype.name = ""; + + /** + * Creates a new VerifyConnectivityRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {google.cloud.kms.v1.IVerifyConnectivityRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.VerifyConnectivityRequest} VerifyConnectivityRequest instance + */ + VerifyConnectivityRequest.create = function create(properties) { + return new VerifyConnectivityRequest(properties); + }; + + /** + * Encodes the specified VerifyConnectivityRequest message. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {google.cloud.kms.v1.IVerifyConnectivityRequest} message VerifyConnectivityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifyConnectivityRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified VerifyConnectivityRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {google.cloud.kms.v1.IVerifyConnectivityRequest} message VerifyConnectivityRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifyConnectivityRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VerifyConnectivityRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.VerifyConnectivityRequest} VerifyConnectivityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifyConnectivityRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.VerifyConnectivityRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VerifyConnectivityRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.VerifyConnectivityRequest} VerifyConnectivityRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifyConnectivityRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VerifyConnectivityRequest message. + * @function verify + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VerifyConnectivityRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a VerifyConnectivityRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.VerifyConnectivityRequest} VerifyConnectivityRequest + */ + VerifyConnectivityRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.VerifyConnectivityRequest) + return object; + var message = new $root.google.cloud.kms.v1.VerifyConnectivityRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a VerifyConnectivityRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {google.cloud.kms.v1.VerifyConnectivityRequest} message VerifyConnectivityRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VerifyConnectivityRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this VerifyConnectivityRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @instance + * @returns {Object.} JSON object + */ + VerifyConnectivityRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VerifyConnectivityRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.VerifyConnectivityRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VerifyConnectivityRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.VerifyConnectivityRequest"; + }; + + return VerifyConnectivityRequest; + })(); + + v1.VerifyConnectivityResponse = (function() { + + /** + * Properties of a VerifyConnectivityResponse. + * @memberof google.cloud.kms.v1 + * @interface IVerifyConnectivityResponse + */ + + /** + * Constructs a new VerifyConnectivityResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a VerifyConnectivityResponse. + * @implements IVerifyConnectivityResponse + * @constructor + * @param {google.cloud.kms.v1.IVerifyConnectivityResponse=} [properties] Properties to set + */ + function VerifyConnectivityResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new VerifyConnectivityResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {google.cloud.kms.v1.IVerifyConnectivityResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.VerifyConnectivityResponse} VerifyConnectivityResponse instance + */ + VerifyConnectivityResponse.create = function create(properties) { + return new VerifyConnectivityResponse(properties); + }; + + /** + * Encodes the specified VerifyConnectivityResponse message. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {google.cloud.kms.v1.IVerifyConnectivityResponse} message VerifyConnectivityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifyConnectivityResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VerifyConnectivityResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.VerifyConnectivityResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {google.cloud.kms.v1.IVerifyConnectivityResponse} message VerifyConnectivityResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifyConnectivityResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VerifyConnectivityResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.VerifyConnectivityResponse} VerifyConnectivityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifyConnectivityResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.VerifyConnectivityResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VerifyConnectivityResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.VerifyConnectivityResponse} VerifyConnectivityResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifyConnectivityResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VerifyConnectivityResponse message. + * @function verify + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VerifyConnectivityResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VerifyConnectivityResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.VerifyConnectivityResponse} VerifyConnectivityResponse + */ + VerifyConnectivityResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.VerifyConnectivityResponse) + return object; + return new $root.google.cloud.kms.v1.VerifyConnectivityResponse(); + }; + + /** + * Creates a plain object from a VerifyConnectivityResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {google.cloud.kms.v1.VerifyConnectivityResponse} message VerifyConnectivityResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VerifyConnectivityResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VerifyConnectivityResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @instance + * @returns {Object.} JSON object + */ + VerifyConnectivityResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VerifyConnectivityResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.VerifyConnectivityResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VerifyConnectivityResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.VerifyConnectivityResponse"; + }; + + return VerifyConnectivityResponse; + })(); + v1.KeyRing = (function() { /** diff --git a/packages/google-cloud-kms/protos/protos.json b/packages/google-cloud-kms/protos/protos.json index ab899061bd4..a879672c3d3 100644 --- a/packages/google-cloud-kms/protos/protos.json +++ b/packages/google-cloud-kms/protos/protos.json @@ -138,6 +138,24 @@ "(google.api.method_signature)": "ekm_config,update_mask" } ] + }, + "VerifyConnectivity": { + "requestType": "VerifyConnectivityRequest", + "responseType": "VerifyConnectivityResponse", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/ekmConnections/*}:verifyConnectivity", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/ekmConnections/*}:verifyConnectivity" + } + }, + { + "(google.api.method_signature)": "name" + } + ] } } }, @@ -466,6 +484,21 @@ } } }, + "VerifyConnectivityRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/EkmConnection" + } + } + } + }, + "VerifyConnectivityResponse": { + "fields": {} + }, "KeyRing": { "options": { "(google.api.resource).type": "cloudkms.googleapis.com/KeyRing", diff --git a/packages/google-cloud-kms/samples/README.md b/packages/google-cloud-kms/samples/README.md index 15aadb58ca4..2defd54272e 100644 --- a/packages/google-cloud-kms/samples/README.md +++ b/packages/google-cloud-kms/samples/README.md @@ -18,6 +18,7 @@ * [Ekm_service.list_ekm_connections](#ekm_service.list_ekm_connections) * [Ekm_service.update_ekm_config](#ekm_service.update_ekm_config) * [Ekm_service.update_ekm_connection](#ekm_service.update_ekm_connection) + * [Ekm_service.verify_connectivity](#ekm_service.verify_connectivity) * [Key_management_service.asymmetric_decrypt](#key_management_service.asymmetric_decrypt) * [Key_management_service.asymmetric_sign](#key_management_service.asymmetric_sign) * [Key_management_service.create_crypto_key](#key_management_service.create_crypto_key) @@ -45,7 +46,6 @@ * [Key_management_service.update_crypto_key_primary_version](#key_management_service.update_crypto_key_primary_version) * [Key_management_service.update_crypto_key_version](#key_management_service.update_crypto_key_version) * [Quickstart](#quickstart) - * [Quickstart.test](#quickstart.test) ## Before you begin @@ -164,6 +164,23 @@ __Usage:__ +### Ekm_service.verify_connectivity + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js` + + +----- + + + + ### Key_management_service.asymmetric_decrypt View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js). @@ -618,23 +635,6 @@ __Usage:__ `node packages/google-cloud-kms/samples/quickstart.js` ------ - - - - -### Quickstart.test - -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/test/quickstart.test.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-kms/samples/test/quickstart.test.js,samples/README.md) - -__Usage:__ - - -`node packages/google-cloud-kms/samples/test/quickstart.test.js` - - diff --git a/packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js b/packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js new file mode 100644 index 00000000000..84e5eeaa873 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/ekm_service.verify_connectivity.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_EkmService_VerifyConnectivity_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.EkmConnection.name of the + * EkmConnection google.cloud.kms.v1.EkmConnection to verify. + */ + // const name = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callVerifyConnectivity() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.verifyConnectivity(request); + console.log(response); + } + + callVerifyConnectivity(); + // [END cloudkms_v1_generated_EkmService_VerifyConnectivity_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json b/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json index 38fa7fdd3bd..17d6f3d99c3 100644 --- a/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json +++ b/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-kms", - "version": "3.5.0", + "version": "3.5.1", "language": "TYPESCRIPT", "apis": [ { @@ -283,6 +283,46 @@ } } }, + { + "regionTag": "cloudkms_v1_generated_EkmService_VerifyConnectivity_async", + "title": "EkmService verifyConnectivity Sample", + "origin": "API_DEFINITION", + "description": " Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_errors.", + "canonical": true, + "file": "ekm_service.verify_connectivity.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "VerifyConnectivity", + "fullName": "google.cloud.kms.v1.EkmService.VerifyConnectivity", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.VerifyConnectivityResponse", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "VerifyConnectivity", + "fullName": "google.cloud.kms.v1.EkmService.VerifyConnectivity", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, { "regionTag": "cloudkms_v1_generated_KeyManagementService_ListKeyRings_async", "title": "EkmService listKeyRings Sample", diff --git a/packages/google-cloud-kms/src/v1/ekm_service_client.ts b/packages/google-cloud-kms/src/v1/ekm_service_client.ts index 6301a34a7b1..a3388519067 100644 --- a/packages/google-cloud-kms/src/v1/ekm_service_client.ts +++ b/packages/google-cloud-kms/src/v1/ekm_service_client.ts @@ -287,6 +287,7 @@ export class EkmServiceClient { 'updateEkmConnection', 'getEkmConfig', 'updateEkmConfig', + 'verifyConnectivity', ]; for (const methodName of ekmServiceStubMethods) { const callPromise = this.ekmServiceStub.then( @@ -813,6 +814,96 @@ export class EkmServiceClient { this.initialize(); return this.innerApiCalls.updateEkmConfig(request, options, callback); } + /** + * Verifies that Cloud KMS can successfully connect to the external key + * manager specified by an {@link google.cloud.kms.v1.EkmConnection|EkmConnection}. + * If there is an error connecting to the EKM, this method returns a + * FAILED_PRECONDITION status containing structured information as described + * at https://cloud.google.com/kms/docs/reference/ekm_errors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.EkmConnection.name|name} of the + * {@link google.cloud.kms.v1.EkmConnection|EkmConnection} to verify. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.kms.v1.VerifyConnectivityResponse | VerifyConnectivityResponse}. + * 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/ekm_service.verify_connectivity.js + * region_tag:cloudkms_v1_generated_EkmService_VerifyConnectivity_async + */ + verifyConnectivity( + request?: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest | undefined, + {} | undefined + ] + >; + verifyConnectivity( + request: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest | null | undefined, + {} | null | undefined + > + ): void; + verifyConnectivity( + request: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + callback: Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest | null | undefined, + {} | null | undefined + > + ): void; + verifyConnectivity( + request?: protos.google.cloud.kms.v1.IVerifyConnectivityRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + | protos.google.cloud.kms.v1.IVerifyConnectivityRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IVerifyConnectivityResponse, + protos.google.cloud.kms.v1.IVerifyConnectivityRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.verifyConnectivity(request, options, callback); + } /** * Lists {@link google.cloud.kms.v1.EkmConnection|EkmConnections}. diff --git a/packages/google-cloud-kms/src/v1/ekm_service_client_config.json b/packages/google-cloud-kms/src/v1/ekm_service_client_config.json index 3e97e7e12e9..b4ef489d214 100644 --- a/packages/google-cloud-kms/src/v1/ekm_service_client_config.json +++ b/packages/google-cloud-kms/src/v1/ekm_service_client_config.json @@ -47,6 +47,10 @@ "UpdateEkmConfig": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "VerifyConnectivity": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-kms/src/v1/gapic_metadata.json b/packages/google-cloud-kms/src/v1/gapic_metadata.json index 449ae15ed7e..f7f8fcf538a 100644 --- a/packages/google-cloud-kms/src/v1/gapic_metadata.json +++ b/packages/google-cloud-kms/src/v1/gapic_metadata.json @@ -35,6 +35,11 @@ "updateEkmConfig" ] }, + "VerifyConnectivity": { + "methods": [ + "verifyConnectivity" + ] + }, "ListEkmConnections": { "methods": [ "listEkmConnections", @@ -72,6 +77,11 @@ "updateEkmConfig" ] }, + "VerifyConnectivity": { + "methods": [ + "verifyConnectivity" + ] + }, "ListEkmConnections": { "methods": [ "listEkmConnections", diff --git a/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts b/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts index 83433e03521..5e8390ccff5 100644 --- a/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts +++ b/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts @@ -885,6 +885,137 @@ describe('v1.EkmServiceClient', () => { }); }); + describe('verifyConnectivity', () => { + it('invokes verifyConnectivity without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.VerifyConnectivityRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityResponse() + ); + client.innerApiCalls.verifyConnectivity = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyConnectivity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyConnectivity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyConnectivity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyConnectivity without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.VerifyConnectivityRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityResponse() + ); + client.innerApiCalls.verifyConnectivity = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyConnectivity( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IVerifyConnectivityResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyConnectivity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyConnectivity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyConnectivity with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.VerifyConnectivityRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyConnectivity = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.verifyConnectivity(request), expectedError); + const actualRequest = ( + client.innerApiCalls.verifyConnectivity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyConnectivity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyConnectivity with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.VerifyConnectivityRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.VerifyConnectivityRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.verifyConnectivity(request), expectedError); + }); + }); + describe('listEkmConnections', () => { it('invokes listEkmConnections without error', async () => { const client = new ekmserviceModule.v1.EkmServiceClient({