@@ -28,9 +28,9 @@ async def run_instance_operations(project_id, instance_id, cluster_id):
2828 # [START bigtable_async_check_instance_exists]
2929 from google .api_core .exceptions import NotFound
3030
31- from google .cloud import bigtable_admin
31+ from google .cloud import bigtable_admin_v2
3232
33- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
33+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
3434 instance_path = client .instance_path (project_id , instance_id )
3535
3636 try :
@@ -43,21 +43,21 @@ async def run_instance_operations(project_id, instance_id, cluster_id):
4343 # [START bigtable_async_create_prod_instance]
4444 from google .api_core .exceptions import NotFound
4545
46- from google .cloud import bigtable_admin
46+ from google .cloud import bigtable_admin_v2
4747
48- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
48+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
4949 project_path = client .common_project_path (project_id )
5050 instance_path = client .instance_path (project_id , instance_id )
5151
52- cluster = bigtable_admin .Cluster (
52+ cluster = bigtable_admin_v2 .Cluster (
5353 location = client .common_location_path (project_id , "us-central1-f" ),
5454 serve_nodes = 1 ,
55- default_storage_type = bigtable_admin .StorageType .SSD ,
55+ default_storage_type = bigtable_admin_v2 .StorageType .SSD ,
5656 )
57- instance_obj = bigtable_admin .Instance (
57+ instance_obj = bigtable_admin_v2 .Instance (
5858 display_name = instance_id ,
5959 labels = {"prod-label" : "prod-label" },
60- type_ = bigtable_admin .Instance .Type .PRODUCTION ,
60+ type_ = bigtable_admin_v2 .Instance .Type .PRODUCTION ,
6161 )
6262
6363 try :
@@ -77,9 +77,9 @@ async def run_instance_operations(project_id, instance_id, cluster_id):
7777 # [END bigtable_async_create_prod_instance]
7878
7979 # [START bigtable_async_list_instances]
80- from google .cloud import bigtable_admin
80+ from google .cloud import bigtable_admin_v2
8181
82- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
82+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
8383 project_path = client .common_project_path (project_id )
8484
8585 print ("\n Listing instances:" )
@@ -89,19 +89,19 @@ async def run_instance_operations(project_id, instance_id, cluster_id):
8989 # [END bigtable_async_list_instances]
9090
9191 # [START bigtable_async_get_instance]
92- from google .cloud import bigtable_admin
92+ from google .cloud import bigtable_admin_v2
9393
94- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
94+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
9595 instance_path = client .instance_path (project_id , instance_id )
9696
9797 inst = await client .get_instance (name = instance_path )
9898 print (f"\n Name of instance: { inst .display_name } \n Labels: { dict (inst .labels )} " )
9999 # [END bigtable_async_get_instance]
100100
101101 # [START bigtable_async_get_clusters]
102- from google .cloud import bigtable_admin
102+ from google .cloud import bigtable_admin_v2
103103
104- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
104+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
105105 instance_path = client .instance_path (project_id , instance_id )
106106
107107 print ("\n Listing clusters..." )
@@ -115,9 +115,9 @@ async def delete_instance(project_id, instance_id):
115115 # [START bigtable_async_delete_instance]
116116 from google .api_core .exceptions import NotFound
117117
118- from google .cloud import bigtable_admin
118+ from google .cloud import bigtable_admin_v2
119119
120- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
120+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
121121 instance_path = client .instance_path (project_id , instance_id )
122122
123123 print ("\n Deleting instance" )
@@ -133,9 +133,9 @@ async def add_cluster(project_id, instance_id, cluster_id):
133133 # [START bigtable_async_create_cluster]
134134 from google .api_core .exceptions import NotFound
135135
136- from google .cloud import bigtable_admin
136+ from google .cloud import bigtable_admin_v2
137137
138- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
138+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
139139 instance_path = client .instance_path (project_id , instance_id )
140140 cluster_path = client .cluster_path (project_id , instance_id , cluster_id )
141141
@@ -144,10 +144,10 @@ async def add_cluster(project_id, instance_id, cluster_id):
144144 for cluster in clusters_response .clusters :
145145 print (cluster .name .split ("/" )[- 1 ])
146146
147- new_cluster = bigtable_admin .Cluster (
147+ new_cluster = bigtable_admin_v2 .Cluster (
148148 location = client .common_location_path (project_id , "us-central1-a" ),
149149 serve_nodes = 1 ,
150- default_storage_type = bigtable_admin .StorageType .SSD ,
150+ default_storage_type = bigtable_admin_v2 .StorageType .SSD ,
151151 )
152152 try :
153153 await client .get_cluster (name = cluster_path )
@@ -177,9 +177,9 @@ async def delete_cluster(project_id, instance_id, cluster_id):
177177 # [START bigtable_async_delete_cluster]
178178 from google .api_core .exceptions import NotFound
179179
180- from google .cloud import bigtable_admin
180+ from google .cloud import bigtable_admin_v2
181181
182- async with bigtable_admin .BigtableInstanceAdminAsyncClient () as client :
182+ async with bigtable_admin_v2 .BigtableInstanceAdminAsyncClient () as client :
183183 cluster_path = client .cluster_path (project_id , instance_id , cluster_id )
184184
185185 print ("\n Deleting cluster" )
0 commit comments