
    &                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJr  SSKJ
r
  SSKJr  SS	KJr  SSKJr  SS
KJr  SSKJr  SSKrSrSr\\S.r\R0                  \R2                  " \R4                  R6                  5       " S S\R8                  5      5       5       r\R0                  \R2                  " \R4                  R<                  \R4                  R>                  5       " S S\R8                  5      5       5       r g)z=Retrieves the latest recovery time for a Cloud SQL instance.
    )absolute_import)division)unicode_literals)
exceptions)api_util)validate)arg_parsers)base)flags)
propertiesNz
    *{command}* retrieves the latest recovery time for a Cloud SQL instance.
    This is the latest time that can be used to perform point in time recovery
    for the Cloud SQL instance.
    a      To retrieve the latest recovery time for an instance:

    $ {command} instance-foo

    To retrieve the latest recovery time for an instance that has been deleted:

    $ {command} instance-foo --source-instance-deletion-time '2012-11-15T16:19:00.094Z'
    )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)GetLatestRecoveryTime9   VDisplays the latest recovery time to which a Cloud SQL instance can be restored to.
  c                     U R                  S[        R                  SS9  U R                  S[        R                  R
                  [        R                  SSS9  g	zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that you can use it to add arguments that go on
    the command line after this command. Positional arguments are allowed.
instancezCloud SQL instance ID.)	completerhelpz--source-instance-deletion-timeFzgThe deletion time of the source instance. This is used to identify the instance if it has been deleted.)typer   requiredr   Nadd_argumentr   InstanceCompleterr	   DatetimeParseparsers    5lib/surface/sql/instances/get_latest_recovery_time.pyArgsGetLatestRecoveryTime.ArgsA   ^     ))%  ' )!!''))4  	    c                 p   [         R                  " [         R                  5      nUR                  nUR                  n[
        R                  " UR                  5        UR                  R                  UR                  S[        R                  R                  R                  R                  0SS9n UR                  UR                  UR                  S9nUR                   (       a   UR                   R#                  S5      Ul        UR&                  R)                  U5      $ ! [*        R,                   a  nUR.                  [0        R2                  R4                  R6                  :X  a3  [8        R:                  " SR=                  UR?                  5       5      5      e[@        RB                  " U5      eSnAff = fa  Displays the latest recovery time to which a Cloud SQL instance can be restored to.

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

Returns:
  A timestamp representing the latest recovery time to which a Cloud SQL
  instance can be restored to.

Raises:
  HttpException: A http error response was received while executing api
      request.
  ResourceNotFoundError: The SQL instance isn't found.
projectzsql.instances)params
collection)r(   r   z%Y-%m-%dT%H:%M:%S.%fZzFThere's no instance found at {} or you're not authorized to access it.N"r   	SqlClientAPI_VERSION_DEFAULT
sql_clientsql_messagesr   ValidateInstanceNamer   resource_parserr   r   VALUEScorer(   	GetOrFail0SqlProjectsInstancesGetLatestRecoveryTimeRequestsource_instance_deletion_timestrftimesourceInstanceDeletionTimeprojects_instancesr   apitools_exceptions	HttpErrorstatus_codesixmoveshttp_client	FORBIDDENr   ResourceNotFoundErrorformatRelativeNamecalliope_exceptionsHttpExceptionselfargsclientr.   r/   instance_refrequesterrors           r!   RunGetLatestRecoveryTime.RunX   e      < <=F""J&&L!!$--0))//:,,1199CCD" 0 $L5MM&&1F1F N Hg		+	+..778OP 	* **@@II(( 5			cii33==	=.. 9 9 ;<> 	>  --e445   1A/D! !F55A;F00F5 N__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr"   rM   __static_attributes__rQ   r%   r!   r   r   9   %      - ,&5r%   r   c                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)GetLatestRecoveryTimeBeta   r   c                     U R                  S[        R                  SS9  U R                  S[        R                  R
                  [        R                  SSS9  gr   r   r   s    r!   r"   GetLatestRecoveryTimeBeta.Args   r$   r%   c                 p   [         R                  " [         R                  5      nUR                  nUR                  n[
        R                  " UR                  5        UR                  R                  UR                  S[        R                  R                  R                  R                  0SS9n UR                  UR                  UR                  S9nUR                   (       a   UR                   R#                  S5      Ul        UR&                  R)                  U5      $ ! [*        R,                   a  nUR.                  [0        R2                  R4                  R6                  :X  a3  [8        R:                  " SR=                  UR?                  5       5      5      e[@        RB                  " U5      eSnAff = fr'   r+   rF   s           r!   rM   GetLatestRecoveryTimeBeta.Run   rO   rP   rQ   NrR   rQ   r%   r!   r^   r^      r\   r%   r^   )!rW   
__future__r   r   r   apitools.base.pyr   r:   googlecloudsdk.api_lib.sqlr   r   googlecloudsdk.callioper	   r
   rD   googlecloudsdk.command_lib.sqlr   googlecloudsdk.corer   six.moves.http_clientr=   r   EXAMPLES_GArX   DefaultUniverseOnlyReleaseTracksReleaseTrackGACommandr   BETAALPHAr^   rQ   r%   r!   <module>rs      s    '  ' > / 1 / / ( E 0 *   D%%(()C5DLL C5 * C5L D%%**D,=,=,C,CDC5 C5 E C5r%   