
    *                         S r SSKJr  SSKJr  S rS r SS jr SS jr  SS	 jr	SS
 jr
SS jrS rS rSS jrS rS rg)z1Code for making shared messages between commands.    )
k8s_object)logc                     SR                  U R                  US9nU HI  nSU-   nX@R                  ;   a  U R                  U   R                  S5      OSnUSR                  X5S9-  nMK     U$ )zReturns a user message for a successful synchronous deploy.

Args:
  service: googlecloudsdk.api_lib.run.service.Service, Deployed service for
    which to build a success message.
  regions: list of regions that we deployed to.
zmMulti-Region Service [{{bold}}{s}{{reset}}] has been deployed to regions {{bold}}{r}{{reset}}.
Regional URLs:)srzMultiRegionReady/message z.
{{bold}}{url}{{reset}} ({{bold}}{r}{{reset}}))r   url)formatname
conditionsget)serviceregionsmsgregion	conditionr
   s         3lib/googlecloudsdk/command_lib/run/messages_util.py0GetSuccessMessageForMultiRegionSynchronousDeployr      s     F  	  f#f,I *** 	9%)))4 
 <CC
 D  C  
*    c                 P   U R                   R                  nU R                   R                  nU(       a  SOU R                  nSnU(       a  US-  nU R                  nSnU(       a  SR                  U5      nUR                  U R                  U(       a  UOUU R                  US9U-   $ )a  Returns a user message for a successful synchronous deploy.

Args:
  service: googlecloudsdk.api_lib.run.service.Service, Deployed service for
    which to build a success message.
  no_traffic: bool, whether the service was deployed with --no-traffic flag.
r   zService [{{bold}}{serv}{{reset}}] revision [{{bold}}{rev}{{reset}}] has been deployed and is serving {{bold}}{latest_percent_traffic}{{reset}} percent of traffic.z$
Service URL: {{bold}}{url}{{reset}}r	   z+
The revision can be reached directly at {})servrevr
   latest_percent_traffic)statuslatestReadyRevisionNamelatestCreatedRevisionNamer   
latest_urlr   r   domain)r   
no_trafficlatest_readylatest_createdr   r   r   tag_url_messages           r   %GetSuccessMessageForSynchronousDeployr$   3   s     77, >>;;. *10N0NF  22C!!*/DKKO 
jj|| *nnn!7	   	r   Nc                    SR                  U S9nU(       a  USR                  US9-  nUS-  nUR                  b  SR                  UR                  5      nOSnSR                  XPS	9nS
R                  X S9nUSR                  XgS9-  nU$ )a  Returns a user message for a successful worker pool deploy/update.

Args:
  worker_pool_name: str, name of the worker pool.
  release_track: base.ReleaseTrack, release track of the command.
  region: str, region of the worker pool.
  revision_name: str, name of the new revision.
z%Worker pool [{{bold}}{name}{{reset}}])r   z" revision [{{bold}}{rev}{{reset}}])r   z has been deployed.z{}betaz0gcloud {track} run worker-pools logs tail {name})trackr   zPhttps://console.cloud.google.com/run/worker-pools/details/{region}/{worker_pool})r   worker_poolz=
Done.

See logs with:
{logs_command}

Or visit {console_url})logs_commandconsole_urlr   prefix)worker_pool_namerelease_trackr   revision_namer   release_track_prefixr)   r*   s           r   /GetSuccessMessageForSynchronousWorkerPoolDeployr1   Z   s     	066<L6M#/66=6IIC	#%;;}';';< "CJJ  K ,
F&F7 
 K
FF>?# 
*r   c                     SnU(       a  US-  nUS-  nX0R                   -  nUR                  U R                  U R                  UUR	                  5       S9$ )af  Returns a user mesage for starting a deploy.

Args:
  conn_context: connection_context.ConnectionInfo, Metadata for the run API
    client.
  parent_ref: protorpc.messages.Message, A resource reference object for the
    resource. See googlecloudsdk.core.resources.Registry.ParseResourceId for
    details.
  resource_name: str | None, name of the resource.
zCreating {operator} instance z[{{bold}}{resource}{{reset}}] z%in {ns_label} [{{bold}}{ns}{{reset}}])operatorns_labelresourcens)location_labelr   r3   r4   Name)conn_context
parent_refresource_namer   s       r   GetStartCreateInstanceMessager<   ~   se     	(#++C	00#	$	$$#	$$$$			 
 
 r   c           	          SnX@R                   -  nUS:X  a  UR                  OUR                  5       R                  5       nUR	                  UU R
                  UU R                  UR                  5       US9$ )a  Returns a user mesage for starting a deploy.

Args:
  conn_context: connection_context.ConnectionInfo, Metadata for the run API
    client.
  resource_ref: protorpc.messages.Message, A resource reference object for the
    resource. See googlecloudsdk.core.resources.Registry.ParseResourceId for
    details.
  operation: str, what deploy action is being done.
  resource_kind_lower: str, resource kind being deployed, e.g. "service"
zj{operation} {operator} {resource_kind} [{{bold}}{resource}{{reset}}] in {ns_label} [{{bold}}{ns}{{reset}}]zworker pool)	operationr3   resource_kindr4   r5   r6   )r7   
projectsIdParentr8   r   r3   r4   )r9   resource_refr>   resource_kind_lowerr   r6   s         r   GetStartDeployMessagerD      s    $L  	$	$$#
 
	-  %%' 
 
$$'$$  "	 
 
 r   c                     SnUR                  UUR                  5       U R                  UR                  5       R                  5       U R                  S9$ )aj  Returns a user mesage for resource not found.

Args:
  conn_context: connection_context.ConnectionInfo, Metadata for the run API
    client.
  resource_ref: protorpc.messages.Message, A resource reference object for the
    resource. See googlecloudsdk.core.resources.Registry.ParseResourceId for
    details.
  resource_kind: str, resource kind, e.g. "Service"
zW{resource_kind} [{resource}] could not be found in {ns_label} [{ns}] region [{region}].)r?   r5   r4   r6   r   )r   r8   r4   rA   r   )r9   rB   r?   r   s       r   GetNotFoundMessagerF      sZ    1 
 
!  "$$					#	#	%   
 
 r   c                     SR                  U(       a  SOSU R                  b  SR                  U R                  5      OSUS9$ )z,Returns a user message for how to run a job.zT
To execute this job{repeat}, use:
gcloud{release_track} run jobs execute {job_name}z againr	    {})repeatr.   job_namer+   )r.   rJ   rI   s      r   GetRunJobMessagerK      sK    ::@&# %%1 ll=//0 ;A ;r   c                    SR                  U R                  b  SR                  U R                  5      OSUR                  S9nUR                  (       a,  UR                  R                  (       a  US[        U5      -   -  nU$ )zAReturns a user message with execution details when running a job.zr
View details about this execution by running:
gcloud{release_track} run jobs executions describe {execution_name}rH   r	   )r.   execution_namez

Or visit )r   r,   r   r   logUri_GetExecutionUiLink)r.   	executionr   s      r   GetExecutionCreatedMessagerQ      s{    L
F !!- ,,}++
,^^    )**11?0;;;C	*r   c                 `    SR                  U R                  U R                  U R                  S9$ )Nzhhttps://console.cloud.google.com/run/jobs/executions/details/{region}/{execution_name}?project={project})r   rM   project)r   r   r   	namespace)rP   s    r   rO   rO      s4    <
F^^!!  r   c                 <    U(       a  SOSnSnUR                  XX#S9$ )ag  Returns a user message for equivalent gcloud commands for source deploy.

Args:
  name: name of the source target, which is either a service, a job or a
    worker
  pack: the pack arguments used to build the container image
  source: the location of the source
  subgroup: subgroup name for this command. Either 'jobs ', 'workers ' or
    empty for services
z--pack image=[IMAGE]z--tag [IMAGE]zThis command is equivalent to running `gcloud builds submit {build_flag} {source}` and `gcloud run {subgroup}deploy {name} --image [IMAGE]`
)r   
build_flagsourcesubgroup)r   )r   packrW   rX   rV   r   s         r   %GetBuildEquivalentForSourceRunMessagerZ     s5     *.%?*? 
 
v 
 
 r   c                 X   SU ;   =(       a    U R                   nSU ;   =(       a    U R                  nSU ;   aQ  U R                  (       a@  U R                  R                  5        H"  u  pESU;   d  M  UR                   (       d  M   SnM$     U=(       ac    UR                  =(       aP    UR                  R
                  =(       a3    UR                  R
                  R                  [        R                  5      nU(       a0  U(       d(  U(       d   [        R                  R                  S5        ggggzELogs a user message for GPU type default value if it is not provided.gpugpu_type
containersTzYNo GPU type is provided, defaulting to nvidia-l4. To specify the GPU type use --gpu-type.N)r]   r^   r_   itemstemplatenode_selectorr   r   GPU_TYPE_NODE_SELECTORr   r   Printargsr5   gpu_setgpu_type_set_container_argshas_gpu_types          r   MaybeLogDefaultGpuTypeMessagerl     s    TM&dhh't#5,Tdoo!__224	.	 ^%7%7%7 5  Q


Q



)
)Q 


)
)
-
-j.O.O
P	  \,JJ	$ +7\Wr   c                 2   SU ;   =(       a    U R                   nSU ;   =(       a    U R                  nSU ;   aQ  U R                  (       a@  U R                  R                  5        H"  u  pESU;   d  M  UR                   (       d  M   SnM$     U=(       aP    UR                  =(       a=    UR                  R
                  =(       a     UR                  R
                  R                  nU(       a0  U(       d(  U(       d   [        R                  R                  S5        ggggr\   )
r]   r^   r_   r`   ra   rb   acceleratorr   r   rd   re   s          r   *MaybeLogDefaultGpuTypeMessageForV2Resourcero   2  s    TM&dhh't#5,Tdoo!__224	.	 ^%7%7%7 5  6


6



)
)6 


)
)
5
5	  \,JJ	$ +7\Wr   )N)zDeploying container tor   )Service)F)r	   )__doc__googlecloudsdk.api_lib.runr   googlecloudsdk.corer   r   r$   r1   r<   rD   rF   rK   rQ   rO   rZ   rl   ro    r   r   <module>ru      sd    8 2 #:$P <@!N > '!	$N2 $,*r   