
                              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ZdZdZdddddZdZdZdZ	 ddZd Zy)z0This module holds exceptions raised by commands.    )absolute_import)division)unicode_literals)deploy_command_util)
exceptions)yaml_parsing)
enable_api)convert_yaml)logNa&  descriptor:                  [{descriptor}]
source:                      [{source}]
target project:              [{project}]
target service:              [{service}]
target version:              [{version}]
target url:                  [{url}]
target service account:      [{service_account}]

zXdescriptor:      [{descriptor}]
type:            [{type}]
target project:  [{project}]

zdatastore indexesz	cron jobsztask queueszrouting rules)indexcronqueuedispatchz_     (add --promote if you also want to make this service available from
     [{default_url}])
zYou've generated a Dockerfile that may be customized for your application.  To use this Dockerfile, the runtime field in [{0}] must be set to custom.zCaution: You are updating queue configuration. This will override any changes
performed using 'gcloud tasks'. More details at
https://cloud.google.com/tasks/docs/queue-yaml
c                 (   i }|r| t        d      t        j                  j                  d       |D ]x  }	t	        j
                  |	j                        }
t	        j                  | |	j                  |rdn||
      }|||	j                  <   t        j                  |      }d}	 |j                  |	j                  j                  j                               j                  dd      }| j*                  }|r|}n|r|}t        j                  j                  t,        j%                  ||	j                  ||	j.                  |	j0                  ||	             |r$t	        j                  | |	j                  |

      }t        j                  j                  t2        j%                  |             { |rt5        ||       |S # t        $ rH}t!        j"                  dj%                  |	j                  t'        j(                  |                  d}~ww xY w)a  Prints the details of the proposed deployment.

  Args:
    app: Application resource for the current application (required if any
      services are deployed, otherwise ignored).
    project: The name of the current project.
    services: [deployables.Service], The services being deployed.
    configs: [yaml_parsing.ConfigYamlInfo], The configurations being updated.
    version: The version identifier of the application to be deployed.
    promote: Whether the newly deployed version will receive all traffic
      (this affects deployed URLs).
    service_account: The service account that the deployed version will run as.
    api_version: Version of the yaml file parser to use. Use 'v1' by default.

  Returns:
    dict (str->str), a mapping of service names to deployed service URLs

  This includes information on to-be-deployed services (including service name,
  version number, and deployed URLs) as well as configurations.
  Nz7If services are deployed, must provide `app` parameter.zServices to deploy:
)appserviceversionuse_ssl serviceAccountzc[{f}] could not be converted to the App Engine configuration format for the following reason: {msg})fmsg)projectr   r   
descriptorsourceurlservice_account)r   r   r   )default_url)	TypeErrorr   statusPrintr   UseSslservice_infoGetAppHostname
service_idr
   GetSchemaParserConvertValueparsedToDictget
ValueErrorr   ConfigErrorformatsix	text_typer   DEPLOY_SERVICE_MESSAGE_TEMPLATEr   r   PROMOTE_MESSAGE_TEMPLATE DisplayProposedConfigDeployments)r   r   servicesconfigsr   promoter   api_versiondeployed_urlsr   r   r   schema_parserservice_account_from_yamledisplay_service_accountr   s                    4lib/googlecloudsdk/command_lib/app/output_helpers.pyDisplayProposedDeploymentr=   I   s   8 -
{OPPJJ,-#**7+?+?@g..7--!$wAc +.mG&&'"22;?m"$?$1$>$>  ''..0%225#6F2M 	" !$ 2 2	"1$";	jj
)
0
0(( ++^^5 1 78 )88W//B

188# 9 % 	&C H $Wg6	9  ?$$55;V&&CMM!,< 6< 6>? 	??s   %AG  	H	AHHc                    t         j                  j                  d       |D ]  }t         j                  j                  t        j	                  | t
        |j                     |j                               |j                  t        j                  j                  k(  s{	 t        j                  | d      }|st        j                   t"                y# t        j                  $ r d}Y 6w xY w)zPrints the details of the proposed config deployments.

  Args:
    project: The name of the current project.
    configs: [yaml_parsing.ConfigYamlInfo], The configurations being
      deployed.
  zConfigurations to update:
)r   typer   zcloudtasks.googleapis.comTN)r   r    r!   DEPLOY_CONFIG_MESSAGE_TEMPLATEr-   CONFIG_TYPESconfigfilenamer   ConfigYamlInfoQUEUEr	   IsServiceEnableds_exceptionsListServicesExceptionwarningQUEUE_TASKS_WARNING)r   r4   capi_maybe_enableds       r<   r2   r2      s     **01aJJ3::l1884 ; I J 	vv,,222!&7702 
 	'(  // ! !s   CC+*C+)v1)__doc__
__future__r   r   r   googlecloudsdk.api_lib.appr   r   r   googlecloudsdk.api_lib.servicesr	   rH   /googlecloudsdk.appengine.admin.tools.conversionr
   googlecloudsdk.corer   r.   r0   r@   rA   r1   RUNTIME_MISMATCH_MSGrK   r=   r2        r<   <module>rX      sz     7 &  ' : 1 3 6 F H # 
	# "  !	 
L   +/HV)rW   