
    '                     "   S r SSKJr  SSKJr  SSKJr  SSKrSSK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	 S
\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S \R                   5      r " S! S"\R                   5      r " S# S$\R                   5      r " S% S&\R                   5      r " S' S(\R                   5      r  " S) S*\R                   5      r! " S+ S,\R                   5      r" " S- S.\RF                  5      r$ " S/ S0\5      r% " S1 S2\5      r& " S3 S4\R                   5      r' " S5 S6\'5      r( " S7 S8\R                   5      r) " S9 S:\R                   5      r* " S; S<\R                   5      r+ " S= S>\	RX                  5      r- " S? S@\R                   5      r.\R^                  " SA\R`                  5      r1SQSB jr2 " SC SD\R                   5      r3 " SE SF\R                   5      r4 " SG SH\55      r6 " SI SJ\R                   5      r7 " SK SL\R                   5      r8 " SM SN\Rr                  5      r: " SO SP\R                   5      r;g)Rz:This module holds exceptions raised by Cloud Run commands.    )absolute_import)division)unicode_literalsN)
exceptionsz=You could deploy using GPUs without zonal redundancy instead.zOYou could deploy with --no-gpu-zonal-redundancy flag attached to your command.
c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )SelfDocumentingError'   zAn error that uses its own docstring as its message if no message given.

Somehow I think this was how all errors worked maybe back when this was Python
2, and it got lost in the shuffle at some point.
c                 ^   > Uc  U R                   R                  n[        [        U ]  U5        g N)	__class____doc__superr   __init__)selfmessager   s     0lib/googlecloudsdk/command_lib/run/exceptions.pyr   SelfDocumentingError.__init__.   s'    &&g	
.w7     __name__
__module____qualname____firstlineno__r   r   __static_attributes____classcell__r   s   @r   r   r   '   s    8 8r   r   c                       \ rS rSrSrSrg)BucketAccessError4   z2Indicates a failed attempt to access a GCS bucket.r   Nr   r   r   r   r   r   r   r   r   r   r   4       :r   r   c                       \ rS rSrSrSrg)CancellationFailedError8   zIndicates failure to cancel.r   Nr!   r   r   r   r$   r$   8       $r   r$   c                       \ rS rSrSrSrg)DeletionFailedError<   zIndicates failure to delete.r   Nr!   r   r   r   r(   r(   <   r&   r   r(   c                       \ rS rSrSrSrg)ConfigurationError@   z$Indicates an error in configuration.r   Nr!   r   r   r   r+   r+   @   s    ,r   r+   c                       \ rS rSrSrSrg)ServiceNotFoundErrorD   z5Indicates that a provided service name was not found.r   Nr!   r   r   r   r.   r.   D       =r   r.   c                       \ rS rSrSrSrg)RevisionNotFoundErrorH   z6Indicates that a provided revision name was not found.r   Nr!   r   r   r   r2   r2   H   s    >r   r2   c                       \ rS rSrSrSrg)JobNotFoundErrorL   z1Indicates that a provided job name was not found.r   Nr!   r   r   r   r5   r5   L   s    9r   r5   c                       \ rS rSrSrSrg)ExecutionNotFoundErrorP   z7Indicates that a provided execution name was not found.r   Nr!   r   r   r   r8   r8   P   s    ?r   r8   c                       \ rS rSrSrSrg)WorkerNotFoundErrorT   z4Indicates that a provided worker name was not found.r   Nr!   r   r   r   r;   r;   T   s    <r   r;   c                       \ rS rSrSrSrg)DockerVersionErrorX   z5Indicates an error in determining the docker version.r   Nr!   r   r   r   r>   r>   X   r0   r   r>   c                       \ rS rSrSrSrg)AmbiguousContainerError\   zGMore than one container fits our criteria, we do not know which to run.r   Nr!   r   r   r   rA   rA   \   s    Or   rA   c                       \ rS rSrSrSrg)CloudSQLError`   z(Malformed instances string for CloudSQL.r   Nr!   r   r   r   rD   rD   `       0r   rD   c                       \ rS rSrSrSrg)ContainerIdErrord   z'Container Id cannot be found by docker.r   Nr!   r   r   r   rH   rH   d       /r   rH   c                       \ rS rSrSrSrg)NoActiveRevisionsErrorh   z-Active revisions were expected but not found.r   Nr!   r   r   r   rL   rL   h   s    5r   rL   c                       \ rS rSrSrSrg)SourceNotSupportedErrorl   z:Your Cloud Run install does not support source deployment.r   Nr!   r   r   r   rO   rO   l   s    Br   rO   c                       \ rS rSrSrSrg)NoConfigurationChangeErrorp   z(No configuration changes were requested.r   Nr!   r   r   r   rR   rR   p   rF   r   rR   c                       \ rS rSrSrSrg)UnknownDeployableErrort   z>Could not identify the deployable app, function, or container.r   Nr!   r   r   r   rU   rU   t   s    Fr   rU   c                       \ rS rSrSrSrg)AppNotReadyErrorx   z;The application must be uploaded before it can be deployed.r   Nr!   r   r   r   rX   rX   x   s    Cr   rX   c                       \ rS rSrSrSrg)DeploymentFailedError|   z+An error was encountered during deployment.r   Nr!   r   r   r   r[   r[   |       3r   r[   c                       \ rS rSrSrSrg)ExecutionFailedError   zThe execution failed.r   Nr!   r   r   r   r_   r_      s    r   r_   c                       \ rS rSrSrSrg)DomainMappingCreationError   zAAn error was encountered during the creation of a domain mapping.r   Nr!   r   r   r   rb   rb      s    Ir   rb   c                       \ rS rSrSrSrg)DomainMappingAlreadyExistsError   ai  Domain mapping already exists in another project, GCP service, or region.

This indicates a succesfully created DomainMapping resource but with the
domain it intends to map being unavailable because it's already in use.
Not to be confused with a 409 error indicating a DomainMapping resource with
this same name (the domain name) already exists in this region.
r   Nr!   r   r   r   re   re      s    r   re   c                       \ rS rSrSrSrg)PlatformError   z'Command not supported for the platform.r   Nr!   r   r   r   rh   rh      rJ   r   rh   c                       \ rS rSrSrg)ArgumentError   r   N)r   r   r   r   r   r   r   r   rk   rk      s    r   rk   c                       \ rS rSrSrSrg)
NoTLSError   zTLS 1.2 support is required to connect to GKE.

Your Python installation does not support TLS 1.2. For Python2, please upgrade
to version 2.7.9 or greater; for Python3, please upgrade to version 3.4 or
greater.
r   Nr!   r   r   r   rn   rn      s    r   rn   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )	HttpError   z(More prettily prints apitools HttpError.c                 J  > [         [        U ]  U5        U R                  R                  (       a  SR                  U R                  R                  R                  5        Vs/ s H  nSR                  U5      PM     sn5      U l        U R                  R                  R                  5        Hn  n[        U R                  R                  U   ;   d  M&  U R                  R                  U   R                  [        [        5      U R                  R                  U'   Mp     g g s  snf )N
z{0}: {{field_violations.{0}}})r   rq   r   payloadfield_violationsjoinkeysformaterror_formatREDEPLOY_GPU_MESSAGEreplaceREDEPLOY_GPU_WITH_FLAG_MESSAGE)r   errorkr   s      r   r   HttpError.__init__   s    	)T#E*||$$))<<00557%7a *
0
0
37% 	d
 ||,,113!4<<#@#@#CC-1\\-J-J.G(*HI ,,
'
'
* 4 %%s   !D )rz   r   r   s   @r   rq   rq      s    0J Jr   rq   c                       \ rS rSrSrSrg)FieldMismatchError   z2Given field value doesn't match the expected type.r   Nr!   r   r   r   r   r      r"   r   r   zG^.*(?:\n.*)*Expected type .+? for field (.+?), found (.+?) \(type .+?\)c                 T   [         R                  [        U 5      5      nU(       a  UR                  S5      S:X  a)  [	        SR                  UR                  S5      5      5      eUR                  S5      S:X  a/  [	        SR                  [        R                  " U 5      U5      5      eU e)a  Special handling for port field type mismatch.

Due to differences in golang structs used by clusters and proto messages used
by gcloud, some invalid service responses should be specially handled.
See b/149365868#comment5 for more info.

Args:
  error: original error complaining of a type mismatch.
  help_text: str, a descriptive message to help with understanding the error.

Raises:
  FieldMismatchError: If the error is due to our own custom handling or the
    original error if not.
   portzError decoding the "port" field. Only integer ports are supported by gcloud. Please change your port from "{}" to an integer value to be compatible with gcloud.   valuez{0}
{1})VALIDATION_ERROR_MSG_REGEXmatchstrgroupr   ry   six	text_type)r~   	help_textregex_matchs      r   MaybeRaiseCustomFieldMismatchr      s     +00U<+v%''-vk.?.?.B'C 
 
		1		(


CMM%0)
<  	+r   c                       \ rS rSrSrSrg)KubernetesError   z+A generic kubernetes error was encountered.r   Nr!   r   r   r   r   r      r]   r   r   c                       \ rS rSrSrSrg)UnsupportedOperationError   z)The requested operation is not supported.r   Nr!   r   r   r   r   r      s    1r   r   c                       \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       rSrg)KubernetesExceptionParser   z-Converts a kubernetes exception to an object.c                 Z    Xl         [        R                  " UR                  5      U l        g)zWraps a generic http error returned by kubernetes.

Args:
  http_error: apitools.base.py.exceptions.HttpError, The error to wrap.
N)_wrapped_errorjsonloadscontent_content)r   
http_errors     r   r   "KubernetesExceptionParser.__init__   s      %JJz112DMr   c                 P     U R                   R                  $ ! [         a     g f = fr   )r   status_codeKeyErrorr   s    r   r   %KubernetesExceptionParser.status_code   s+      ,,, s    
%%c                 .    U R                   R                  $ r   )r   urlr   s    r   r   KubernetesExceptionParser.url   s    """r   c                 B     U R                   S   $ ! [         a     g f = f)N
apiVersionr   r   r   s    r   api_version%KubernetesExceptionParser.api_version  s(    ]]<((     
c                 H     U R                   S   S   $ ! [         a     g f = f)Ndetailsr   r   r   s    r   api_name"KubernetesExceptionParser.api_name	  s-    ]]9%g..     
!!c                 H     U R                   S   S   $ ! [         a     g f = f)Nr   namer   r   s    r   resource_name'KubernetesExceptionParser.resource_name  -    ]]9%f-- r   c                 H     U R                   S   S   $ ! [         a     g f = f)Nr   kindr   r   s    r   resource_kind'KubernetesExceptionParser.resource_kind  r   r   c                 B     U R                   S   $ ! [         a     g f = f)Nr   r   r   s    r   default_message)KubernetesExceptionParser.default_message  s(    ]]9%% r   c                     U R                   $ r   )r   r   s    r   r~   KubernetesExceptionParser.error%  s    r   c                      U R                   S   S    Vs0 s H  oS   U_M
     nn[        U5       Vs/ s H  o2U   PM	     sn$ s  snf s  snf ! [         a    / s $ f = f)z.Returns list of causes uniqued by the message.r   causesr   )r   sortedr   )r   cmessagesr   s       r   r    KubernetesExceptionParser.causes)  sl    +/==+CH+MN+MaI,/+MhN#)(#34#3aqk#344 O4 is,   A AA A
A 
A AA)r   r   N)r   r   r   r   r   r   propertyr   r   r   r   r   r   r   r~   r   r   r   r   r   r   r      s    53   # #              r   r   c                       \ rS rSrSrSrg)BaseImageErrori3  z5An error was encountered when parsing the base image.r   Nr!   r   r   r   r   r   3  r0   r   r   c                       \ rS rSrSrSrg)ServiceAccountErrori7  z8Indicates error due to service account misconfiguration.r   Nr!   r   r   r   r   r   7  s    @r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )RequiredImageArgumentExceptioni;  z3An exception for missing image flag for containers.c                 j   > [         [        U ]  SSR                  SR	                  U5      5      5        g )Nz--imagez2Containers {} require a container image to deploy.z, )r   r   r   ry   rw   )r   
containersr   s     r   r   'RequiredImageArgumentException.__init__>  s0    	
($8<CCIIj!	
r   r   r   r   s   @r   r   r   ;  s    ; r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )NoGrpcInstalledErroriG  z8Error that occurs when the gRPC module is not installed.c                 ,   > [         [        U ]  S5        g )NzPlease ensure that the gRPC module is installed and the environment is correctly configured. Run `sudo pip3 install grpcio` and set the environment variable CLOUDSDK_PYTHON_SITEPACKAGES=1.)r   r   r   )r   r   s    r   r   NoGrpcInstalledError.__init__J  s    	
.	?r   r   r   r   s   @r   r   r   G  s    @ r   r   ) )<r   
__future__r   r   r   r   regooglecloudsdk.api_lib.utilr   exceptions_utilgooglecloudsdk.calliopec_exceptionsgooglecloudsdk.corer   r{   r}   Errorr   r   r$   r(   r+   r.   r2   r5   r8   r;   r>   rA   rD   rH   rL   rO   rR   rU   InternalErrorrX   r[   r_   rb   re   rh   rk   rn   HttpExceptionrq   r   compile	MULTILINEr   r   r   r   objectr   r   r   RequiredArgumentExceptionr   r   r   r   r   <module>r      s   A &  '  	 E > * 
 D  
8:++ 
8;
(( ;%j.. %%*** %-)) ->:++ >?J,, ?:z'' :@Z-- @=*** =>)) >Pj.. P1J$$ 10z'' 06Z-- 6Cj.. C1!1!1 1GZ-- GDz// D40 4/ J!1!1 J&@ 0J$$ 0J$$ !! J-- J$;)) ;  ZZNLL <4j&& 42
 0 0 2E EP>Z%% >A*** A	\%K%K 	:++ r   