
                             S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  SS	KJr   " S
 S\	R                  5      rg)z bigtable tables restore command.    )absolute_import)division)unicode_literalsN)util)base)	arguments)logc                   x    \ rS rSrSr\R                  " S5      \R                  " S5      S.r\S 5       r	S r
Srg	)
RestoreTables   z/Restore a Cloud Bigtable backup to a new table.zS
          This command restores a Cloud Bigtable backup to a new table.
          a  
          To restore table 'table2' from backup 'backup1', run:

            $ {command} --source-instance=instance1 --source-cluster=cluster1 --source=backup1 --destination-instance=instance1 --destination=table2

          To restore table 'table2' from backup 'backup1' in a different project, run:

            $ {command} --source=projects/project1/instances/instance1/clusters/cluster1/backups/backup1 --destination=projects/project2/instances/instance2/tables/table2
          )DESCRIPTIONEXAMPLESc                 x    [         R                  " U 5        [         R                  " U 5      R                  5         g)z Register flags for this command.N)r   AddTableRestoreResourceArgArgAdderAddAsync)parsers    0lib/surface/bigtable/instances/tables/restore.pyArgsRestoreTables.Args0   s)     ((0v'')    c                    [         R                  " 5       n[         R                  " 5       nUR                  R                  R                  5       nUR                  R                  R                  5       nUR                  UR                  5       UR                  5       S9nUR                  UR                  5       R                  5       US9nUR                  R                  U5      n[         R                  " U5      n	UR                  (       aB  [         R"                  " U	R                  5       SR%                  UR                  5       5      SS9  g[         R&                  " U	SR%                  UR                  5       5      5      $ )zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
)backuptableId)parentrestoreTableRequestzbigtable table {0}T)kindis_asyncNzCreating bigtable table {0})r   GetAdminClientGetAdminMessagesCONCEPTSsourceParsedestinationRestoreTableRequestRelativeNameName2BigtableadminProjectsInstancesTablesRestoreRequestParentprojects_instances_tablesRestoreGetOperationRefasync_r	   CreatedResourceformat
AwaitTable)
selfargsclimsgs
backup_ref	table_refrestore_requestmsg	operationoperation_refs
             r   RunRestoreTables.Run6   s<    


C  "D%%++-J))//1I..&&( 	 / "O BB!..0+ C -C
 --55c:I((3M{{	

$
$
&#**9>>+;< ??%,,Y^^-=>@ @r    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr   r;   __static_attributes__r=   r   r   r   r      sL    7 //   //  -" * *
$@r   r   )rB   
__future__r   r   r   rC   googlecloudsdk.api_lib.bigtabler   googlecloudsdk.callioper   #googlecloudsdk.command_lib.bigtabler   googlecloudsdk.corer	   RestoreCommandr   r=   r   r   <module>rN      s6    ' &  '  0 ( 9 #=@D'' =@r   