
    ;                     b   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddl
mZ dd	lmZ e	j                   e	j                   e	j"                  j$                  e	j"                  j&                  e	j"                  j(                         G d
 de	j*                                      Zy)z%Retrieves information about a backup.    )absolute_import)division)unicode_literals)api_util)validate)base)flags)
propertiesc                   ,    e Zd ZdZed        Zd Zd Zy)DescribezQRetrieves information about a backup.

  Retrieves information about a backup.
  c                 X    t        j                  |        t        j                  |        y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    N)r	   AddBackupIdAddOptionalInstance)parsers    #lib/surface/sql/backups/describe.pyArgszDescribe.Args'   s      
f	f%    c                 ,   t        j                  t         j                        }|j                  }|j                  }t        j                  |      r-|j                  |      }|j                  j                  |      S |j                  j                  |dt        j                  j                  j                  j                   id      }|j#                  |j                  |j$                  t'        |            }|j(                  j+                  |      S )N)nameprojectzsql.instances)params
collection)r   instanceid)r   	SqlClientAPI_VERSION_DEFAULT
sql_clientsql_messagescommand_validateIsProjectLevelBackupRequestSqlBackupsGetBackupRequestbackups	GetBackupresource_parserParser
   VALUEScorer   	GetOrFailSqlBackupRunsGetRequestr   int
backupRunsGet)self	backup_idinstance_nameclientr   r   requestinstance_refs           r   _GetByIdzDescribe._GetById3   s     < <=F""J&&L33I>77Y7Gg))'22))//:,,1199CCD" 0 L 22$$&&y> 3 G
   $$W--r   c                     |j                   rt        j                  |j                          | j                  |j                  |j                         S )zRetrieves information about a backup.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object that has the backup run resource if the command ran
      successfully.
    )r   r   ValidateInstanceNamer3   r   )r-   argss     r   RunzDescribe.RunI   s6     }}##DMM2==$--00r   N)__name__
__module____qualname____doc__staticmethodr   r3   r7    r   r   r   r      s%    

 	& 	&.,1r   r   N)r;   
__future__r   r   r   googlecloudsdk.api_lib.sqlr   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.sqlr	   r   googlecloudsdk.corer
   DefaultUniverseOnlyReleaseTracksReleaseTrackGABETAALPHADescribeCommandr   r=   r   r   <module>rJ      s    , &  ' / / ( 0 G * $++00$2C2C2I2I71t## 71 71r   