
    r                     .   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 dd	lmZ dd
lmZ ddlZej(                   ej*                  ej,                  j.                         G d dej0                                      Zy)zFRetrieves the minimal storage size a Cloud SQL instance can be shrunk.    )absolute_import)division)unicode_literals)
exceptions)api_util)validate)base)flags)
propertiesNc                   &    e Zd ZdZed        Zd Zy)GetStorageShrinkConfigzTDisplays the minimum storage size to which a Cloud SQL instance can be decreased.
  c                 H    | j                  dt        j                  d       y)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helpN)add_argumentr
   InstanceCompleter)parsers    6lib/surface/sql/instances/get_storage_shrink_config.pyArgszGetStorageShrinkConfig.Args(   s&     ))%  '    c                    t        j                  t         j                        }|j                  }|j                  }t        j                  |j                         |j                  j                  |j                  dt        j                  j                  j                  j                  id      }	 |j                  |j                  |j                        }|j                   j#                  |      }|S # t$        j&                  $ r}}|j(                  t*        j,                  j.                  j0                  k(  r2t3        j4                  dj7                  |j9                                     t;        j<                  |      d}~ww xY w)a  Displays the minimum storage size to which a Cloud SQL instance can be decreased.

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

    Returns:
      A kind string representing the request run and the minimum storage
      size to which a Cloud SQL instance can be decreased.

    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   zFThere'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_parserParser   VALUEScorer   	GetOrFail.SqlProjectsInstancesGetDiskShrinkConfigRequestprojects_instancesGetDiskShrinkConfigapitools_exceptions	HttpErrorstatus_codesixmoveshttp_client	FORBIDDENr   ResourceNotFoundErrorformatRelativeNamecalliope_exceptionsHttpException)	selfargsclientr   r   instance_refrequestr   errors	            r   RunzGetStorageShrinkConfig.Run5   sA      < <=F""J&&L!!$--0))//:,,1199CCD" 0 $L
5KK&&1F1F L Hg..BB7Kho(( 5			cii33==	=.. 9 9 ;<> 	>  --e445s   2AC6 6F	A8FFN)__name__
__module____qualname____doc__staticmethodr   r;    r   r   r   r   "   s      
' 
'#5r   r   )r?   
__future__r   r   r   apitools.base.pyr   r)   googlecloudsdk.api_lib.sqlr   r   googlecloudsdk.callioper	   r3   googlecloudsdk.command_lib.sqlr
   googlecloudsdk.corer   six.moves.http_clientr,   HiddenReleaseTracksReleaseTrackALPHACommandr   rA   r   r   <module>rN      ss    M &  ' > / 1 / ( E 0 *  D%%++,45T\\ 45 - 45r   