@@ -227,6 +227,24 @@ def parse_crypto_key_path(path: str) -> Dict[str, str]:
227
227
)
228
228
return m .groupdict () if m else {}
229
229
230
+ @staticmethod
231
+ def hot_tablet_path (
232
+ project : str , instance : str , cluster : str , hot_tablet : str ,
233
+ ) -> str :
234
+ """Returns a fully-qualified hot_tablet string."""
235
+ return "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}" .format (
236
+ project = project , instance = instance , cluster = cluster , hot_tablet = hot_tablet ,
237
+ )
238
+
239
+ @staticmethod
240
+ def parse_hot_tablet_path (path : str ) -> Dict [str , str ]:
241
+ """Parses a hot_tablet path into its component segments."""
242
+ m = re .match (
243
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/clusters/(?P<cluster>.+?)/hotTablets/(?P<hot_tablet>.+?)$" ,
244
+ path ,
245
+ )
246
+ return m .groupdict () if m else {}
247
+
230
248
@staticmethod
231
249
def instance_path (project : str , instance : str ,) -> str :
232
250
"""Returns a fully-qualified instance string."""
@@ -240,6 +258,22 @@ def parse_instance_path(path: str) -> Dict[str, str]:
240
258
m = re .match (r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)$" , path )
241
259
return m .groupdict () if m else {}
242
260
261
+ @staticmethod
262
+ def table_path (project : str , instance : str , table : str ,) -> str :
263
+ """Returns a fully-qualified table string."""
264
+ return "projects/{project}/instances/{instance}/tables/{table}" .format (
265
+ project = project , instance = instance , table = table ,
266
+ )
267
+
268
+ @staticmethod
269
+ def parse_table_path (path : str ) -> Dict [str , str ]:
270
+ """Parses a table path into its component segments."""
271
+ m = re .match (
272
+ r"^projects/(?P<project>.+?)/instances/(?P<instance>.+?)/tables/(?P<table>.+?)$" ,
273
+ path ,
274
+ )
275
+ return m .groupdict () if m else {}
276
+
243
277
@staticmethod
244
278
def common_billing_account_path (billing_account : str ,) -> str :
245
279
"""Returns a fully-qualified billing_account string."""
@@ -2215,6 +2249,88 @@ def test_iam_permissions(
2215
2249
# Done; return the response.
2216
2250
return response
2217
2251
2252
+ def list_hot_tablets (
2253
+ self ,
2254
+ request : Union [bigtable_instance_admin .ListHotTabletsRequest , dict ] = None ,
2255
+ * ,
2256
+ parent : str = None ,
2257
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2258
+ timeout : float = None ,
2259
+ metadata : Sequence [Tuple [str , str ]] = (),
2260
+ ) -> pagers .ListHotTabletsPager :
2261
+ r"""Lists hot tablets in a cluster, within the time range
2262
+ provided. Hot tablets are ordered based on CPU usage.
2263
+
2264
+ Args:
2265
+ request (Union[google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest, dict]):
2266
+ The request object. Request message for
2267
+ BigtableInstanceAdmin.ListHotTablets.
2268
+ parent (str):
2269
+ Required. The cluster name to list hot tablets. Value is
2270
+ in the following form:
2271
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
2272
+
2273
+ This corresponds to the ``parent`` field
2274
+ on the ``request`` instance; if ``request`` is provided, this
2275
+ should not be set.
2276
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2277
+ should be retried.
2278
+ timeout (float): The timeout for this request.
2279
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
2280
+ sent along with the request as metadata.
2281
+
2282
+ Returns:
2283
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListHotTabletsPager:
2284
+ Response message for
2285
+ BigtableInstanceAdmin.ListHotTablets.
2286
+ Iterating over this object will yield
2287
+ results and resolve additional pages
2288
+ automatically.
2289
+
2290
+ """
2291
+ # Create or coerce a protobuf request object.
2292
+ # Quick check: If we got a request object, we should *not* have
2293
+ # gotten any keyword arguments that map to the request.
2294
+ has_flattened_params = any ([parent ])
2295
+ if request is not None and has_flattened_params :
2296
+ raise ValueError (
2297
+ "If the `request` argument is set, then none of "
2298
+ "the individual field arguments should be set."
2299
+ )
2300
+
2301
+ # Minor optimization to avoid making a copy if the user passes
2302
+ # in a bigtable_instance_admin.ListHotTabletsRequest.
2303
+ # There's no risk of modifying the input as we've already verified
2304
+ # there are no flattened fields.
2305
+ if not isinstance (request , bigtable_instance_admin .ListHotTabletsRequest ):
2306
+ request = bigtable_instance_admin .ListHotTabletsRequest (request )
2307
+ # If we have keyword arguments corresponding to fields on the
2308
+ # request, apply these.
2309
+ if parent is not None :
2310
+ request .parent = parent
2311
+
2312
+ # Wrap the RPC method; this adds retry and timeout information,
2313
+ # and friendly error handling.
2314
+ rpc = self ._transport ._wrapped_methods [self ._transport .list_hot_tablets ]
2315
+
2316
+ # Certain fields should be provided within the metadata header;
2317
+ # add these here.
2318
+ metadata = tuple (metadata ) + (
2319
+ gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
2320
+ )
2321
+
2322
+ # Send the request.
2323
+ response = rpc (request , retry = retry , timeout = timeout , metadata = metadata ,)
2324
+
2325
+ # This method is paged; wrap the response in a pager, which provides
2326
+ # an `__iter__` convenience method.
2327
+ response = pagers .ListHotTabletsPager (
2328
+ method = rpc , request = request , response = response , metadata = metadata ,
2329
+ )
2330
+
2331
+ # Done; return the response.
2332
+ return response
2333
+
2218
2334
def __enter__ (self ):
2219
2335
return self
2220
2336
0 commit comments