
                             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  ej                  ej                  j                         G d
 dej                                Zy)zICommand for creating or replacing an application from YAML specification.    )absolute_import)division)print_function)unicode_literals)base)flags)run_apps_operations)
exceptionsc                   6    e Zd ZdZdddZed        Zd Zd Zy)	Deployz;Create or replace an application from a YAML specification.z"          {description}
          zf          To create an application from specification

              $ {command} stack.yaml

         )DESCRIPTIONEXAMPLESc                 X    t        j                  |       t        j                  |       y )N)r   
AddFileArgAddServiceAccountArg)clsparsers     lib/surface/stacks/deploy.pyArgszDeploy.Args,   s    	V	v&    c                 p    d|vrd|vrt        j                  d      d|v rt        j                  d      y )Nname	resourcesz!'name' or 'resources' is missing.z/tztabs found in manifest content.)r
   FieldMismatchErrorConfigurationError)selffile_contents     r   _ValidateAppConfigFilezDeploy._ValidateAppConfigFile1   sB    \!k&E))*MNN|))*KLL r   c                     |j                   }| j                  |       | j                         }t        j                  ||      5 }|j                          |j                  |      cddd       S # 1 sw Y   yxY w)z'Create or Update application from YAML.N)FILEr   ReleaseTrackr	   ConnectVerifyLocation	ApplyYaml)r   argsr   release_trackclients        r   Runz
Deploy.Run7   sa     99L-%%'M		$	$T=	9Vl+ 
:	9	9s   !A//A8N)	__name__
__module____qualname____doc__detailed_helpclassmethodr   r   r(    r   r   r   r      s5    C	
- ' 'M
,r   r   N)r,   
__future__r   r   r   r   googlecloudsdk.callioper   +googlecloudsdk.command_lib.run.integrationsr   r	   "googlecloudsdk.command_lib.runappsr
   ReleaseTracksr!   ALPHACommandr   r/   r   r   <module>r7      s[    P &  % ' ( = K 9 D%%++,$,T\\ $, -$,r   