@@ -395,17 +395,25 @@ def delete(self):
395395 request = {"name" : self .name }
396396 )
397397
398- def restore (self , table_id ):
398+ def restore (self , table_id , instance_id = None ):
399399 """Creates a new Table by restoring from this Backup. The new Table
400- must be in the same Instance as the Instance containing the Backup.
400+ can be created in the same Instance as the Instance containing the
401+ Backup, or another Instance whose ID can be specified in the arguments.
401402 The returned Table ``long-running operation`` can be used to track the
402403 progress of the operation and to cancel it. The ``response`` type is
403404 ``Table``, if successful.
404405
406+ :type table_id: str
405407 :param table_id: The ID of the Table to create and restore to.
406408 This Table must not already exist.
407- :returns: An instance of
408- :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture`.
409+
410+ :type instance_id: str
411+ :param instance_id: (Optional) The ID of the Instance to restore the
412+ backup into, if different from the current one.
413+
414+ :rtype: :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture`
415+ :returns: A future to be used to poll the status of the 'restore'
416+ request.
409417
410418 :raises: google.api_core.exceptions.AlreadyExists: If the table
411419 already exists.
@@ -416,12 +424,15 @@ def restore(self, table_id):
416424 :raises: ValueError: If the parameters are invalid.
417425 """
418426 api = self ._instance ._client ._table_admin_client
427+ if instance_id :
428+ parent = BigtableTableAdminClient .instance_path (
429+ project = self ._instance ._client .project , instance = instance_id ,
430+ )
431+ else :
432+ parent = self ._instance .name
433+
419434 return api .restore_table (
420- request = {
421- "parent" : self ._instance .name ,
422- "table_id" : table_id ,
423- "backup" : self .name ,
424- }
435+ request = {"parent" : parent , "table_id" : table_id , "backup" : self .name }
425436 )
426437
427438 def get_iam_policy (self ):
0 commit comments