
    	                         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\
R                  5      r " S S5      rS rS rg)z0Functions that directly interact with Cloud Run.    )absolute_import)division)unicode_literals)connection_context)	platforms)serverless_operations)
exceptions)
console_ioc                       \ rS rSrSrSrg)ServiceAlreadyExistsError   zCError thrown if the service already exists and overwrite denied.
   N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       5lib/googlecloudsdk/command_lib/code/cloud/cloudrun.pyr   r      s    r   r   c                        \ rS rSrS rS rSrg)_ServiceResource!   c                     Xl         X l        g )Nprojectservice_name)selfr   r   s      r   __init___ServiceResource.__init__#   s    L$r   c                 N    SR                  U R                  U R                  5      $ )Nznamespaces/{}/services/{})formatr   r   )r   s    r   RelativeName_ServiceResource.RelativeName'   s    &--dllD<M<MNNr   r   N)r   r   r   r   r   r#   r   r   r   r   r   r   !   s    %Or   r   c                     [         R                  " U U[        R                  US9n[        R
                  " U5       nUR                  [        X5      5      sSSS5        $ ! , (       d  f       g= f)z?Check to see if the service with the given name already exists.)release_trackplatformregion_labelN)r   GetConnectionContextr   PLATFORM_MANAGEDr   Connect
GetServicer   )argsr   r   regionr&   contextclients          r   ServiceExistsr1   +   sV    33
!))	' $$W--gDE .--s   A  
A.c                 0   [        U UR                  UR                  UR                  U5      (       ad  [        R
                  " 5       (       a?  [        R                  " SR                  UR                  UR                  5      SS9(       a  g[        S5      eg)zBIf the service already exists, prompt the user before overwriting.z'Serivce {} already exists in project {}zDo you want to overwrite it?)messageprompt_stringNzService already exists.)	r1   r   r   r.   r
   	CanPromptPromptContinuer"   r   )r-   settingsr&   s      r   PromptToOverwriteCloudr8   7   s    
oo  *";";9@@!!8#3#3
 5	# 
#$=
>>r   N)r   
__future__r   r   r   googlecloudsdk.command_lib.runr   r   r   googlecloudsdk.corer	   googlecloudsdk.core.consoler
   Errorr   r   r1   r8   r   r   r   <module>r>      sK    7 &  ' = 4 @ * 2
 0 0 
O O	F?r   