以非同步方式刪除執行個體

以非同步方式刪除執行個體。

程式碼範例

Python

如要瞭解如何安裝及使用 Bigtable 的用戶端程式庫,請參閱「Bigtable 用戶端程式庫」。

如要向 Bigtable 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

from google.api_core.exceptions import NotFound

from google.cloud import bigtable_admin_v2

async with bigtable_admin_v2.BigtableInstanceAdminAsyncClient() as client:
    instance_path = client.instance_path(project_id, instance_id)

    print("\nDeleting instance")
    try:
        await client.delete_instance(name=instance_path)
        print(f"Deleted instance: {instance_id}")
    except NotFound:
        print(f"Instance {instance_id} does not exist.")

後續步驟

如要搜尋及篩選其他 Google Cloud 產品的程式碼範例,請參閱Google Cloud 範例瀏覽工具。