
    !                        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rSr\\S.r\
R&                  " \
R(                  R*                  5       " S S\
R,                  5      5       rg)GAcquires a SQL Server Reporting Services lease on a Cloud SQL instance.    )absolute_import)division)unicode_literals)api_util)
operations)validate)base)flags)log)
propertieszO    Acquire a SQL Server Reporting Services lease on a Cloud SQL instance.
    z    To acquire a SQL Server Reporting Services lease on an instance:

    $ {command} instance-foo --setup-login=setuplogin --service-login=reportuser --report-database=ReportServer --duration=4h
    )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)AcquireSsrsLease-   r   c                 n    U R                  S[        R                  SS9  [        R                  " U 5        g)ak  Args 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.

Returns:
  A dict object representing the operations resource describing the acquire
  SSRS lease operation if the operation was successful.
instancezCloud SQL instance ID.)	completerhelpN)add_argumentr   InstanceCompleterAddSqlServerSsrs)parsers    /lib/surface/sql/instances/acquire_ssrs_lease.pyArgsAcquireSsrsLease.Args3   s6     ))%   
6"    c                    [         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                  nUb  [!        UR                  5      S-   nUR#                  UR                  UR                  UR%                  UR'                  UR(                  UR*                  UR,                  US9S9S9nUR.                  R1                  U5      nUR                  R3                  S	UR4                  UR                  S
9n	[6        R8                  R;                  X9S5        [<        R>                  RA                  S5        g)a:  Acquires a SQL Server Reporting Services lease on a Cloud SQL instance.

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

Returns:
  A dict object representing the operations resource describing the
  acquire-ssrs-lease operation if the acquire-ssrs-lease was successful.
projectzsql.instances)params
collectionNs)
setupLoginserviceLoginreportDatabaseduration)acquireSsrsLeaseContext)r   r     instancesAcquireSsrsLeaseRequestzsql.operations)	operationr    zAcquiring SSRS leasez"Successfully acquired SSRS lease.
)!r   	SqlClientAPI_VERSION_DEFAULT
sql_clientsql_messagesr	   ValidateInstanceNamer   resource_parserParser   VALUEScorer    	GetOrFailr'   str#SqlInstancesAcquireSsrsLeaseRequest InstancesAcquireSsrsLeaseRequestAcquireSsrsLeaseContextsetup_loginservice_loginreport_database	instancesr   CreateoperationIdr   OperationsV1Beta4WaitForOperationr   statuswrite)
selfargsclientr-   r.   instance_refduration_strrequestresultoperation_refs
             r   RunAcquireSsrsLease.RunG   s     < <=F""J&&L!!$--0))//:,,1199CCD" 0 $L
 ==L'#-l>>&&$$)5)V)V$0$H$H++!//#33%	 %I % *W * ? 
G !!227;F**11$$$$ 2 &M
   11*2HJ JJ:;r    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr   rK   __static_attributes__rM   r   r   r   r   -   s!    O-# #&/<r   r   N)rR   
__future__r   r   r   googlecloudsdk.api_lib.sqlr   r   r	   googlecloudsdk.callioper
   googlecloudsdk.command_lib.sqlr   googlecloudsdk.corer   r   r   r   rS   ReleaseTracksReleaseTrackGACommandr   rM   r   r   <module>r`      s    N &  ' / 1 / ( 0 # *  D%%(()H<t|| H< *H<r   