
                         V   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mZ dd
lmZ ddlmZ dZdZde de Zd Z ej4                  ej6                  j8                         G d de
j:                  ej<                               Z ej4                  ej6                  j@                         G d de             Z! ej4                  ej6                  jD                         G d de!             Z#ddiZ$e$e_%        e$e!_%        e$e#_%        y)z+Creates or updates a Google Cloud Function.    )absolute_import)division)unicode_literals)base)flags)secrets_config)util)command)labels_util)env_vars_util)logzYou can disable this behavior by explicitly specifying the --no-gen2 flag or by setting the functions/gen2 config property to 'off'.zTo learn more about the differences between 1st gen and 2nd gen functions, visit:
https://cloud.google.com/functions/docs/concepts/version-comparisona  As of Cloud SDK 492.0.0 release, new functions will be deployed as 2nd gen functions by default. This is equivalent to currently deploying new with the --gen2 flag. Existing 1st gen functions will not be impacted and will continue to deploy as 1st gen functions.

c                    t        j                  | d       t        j                  |        t        j                  |        t        j                  |        t        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  | t        j                  t        j                         t        j                  |        t        j                  |        t        j                   |        t        j"                  |        t%        j&                  |        t%        j(                  |        t        j*                  |        t        j,                  | |       t        j.                  |        t        j0                  |        t3        j4                  |        t        j6                  |        t        j8                  |        t        j:                  |        t        j<                  |        t        j>                  |        t        j@                  |        t        jB                  |        t        jD                  |        t        jF                  |        t        jH                  |        t        jJ                  |        t        jL                  |        t        jN                  |        t        jP                  |        y)z%Register base flags for this command.z	to deploy)extra_update_messageextra_remove_messageN))r   AddFunctionResourceArgAddFunctionMemoryAndCpuFlagsAddAllowUnauthenticatedFlagAddFunctionRetryFlagAddFunctionTimeoutFlagAddMaxInstancesFlagAddMinInstancesFlagAddRuntimeFlagAddServiceAccountFlagargs_labels_utilAddUpdateLabelsFlagsr   &NO_LABELS_STARTING_WITH_DEPLOY_MESSAGEAddSourceFlagAddStageBucketFlagAddEntryPointFlagAddTriggerFlagGroupr   AddUpdateEnvVarsFlagsAddBuildEnvVarsFlagsAddIgnoreFileFlagAddRuntimeUpdatePolicyAddKMSKeyFlagsAddDockerRepositoryFlagsr   ConfigureFlagsAddVPCConnectorMutexGroupAddEgressSettingsFlagAddIngressSettingsFlagAddSecurityLevelFlagAddBuildWorkerPoolMutexGroupAddDockerRegistryFlagsAddRunServiceAccountFlagAddTriggerLocationFlagAddTriggerServiceAccountFlagAddGen2Flag$AddServeAllTrafficLatestRevisionFlagAddConcurrencyFlagAddBuildServiceAccountFlag AddBinaryAuthorizationMutexGroup)parsertracks     lib/surface/functions/deploy.py_CommonArgsr:   6   s%    v{3 $$V, ##F+V$v&F#F#vf%''&MM&MM f6"&! F# %%f- $$V, &! vu- v  ( ' !!&)f%v&V$$$V, v&   (v&$$V,F,,V46" ""6* ((0    c                   ,    e Zd ZdZed        Zd Zd Zy)Deploy)Create or update a Google Cloud Function.c                 L    t        | t        j                  j                         y N)r:   r   ReleaseTrackGAr7   s    r9   ArgszDeploy.Args   s    )),,-r;   c                 L    t        j                  || j                               S )N)r8   )
command_v1RunrA   selfargss     r9   _RunV1zDeploy._RunV1   s    >>$d&7&7&9::r;   c                     | j                   s7t        j                         s#t        j                  j                  t               t        j                  || j                               S r@   )
_v2_functionr   ShouldUseGen2r   statusPrint_NEW_CHANGE_WARNING
command_v2rG   rA   rH   s     r9   _RunV2zDeploy._RunV2   sC    U%8%8%:	jj*+>>$ 1 1 344r;   N)__name__
__module____qualname____doc__staticmethodrD   rK   rS    r;   r9   r=   r=      s!    1. .;5r;   r=   c                        e Zd ZdZed        Zy)
DeployBetar>   c                 L    t        | t        j                  j                         yz<Register alpha (and implicitly beta) flags for this command.N)r:   r   rA   BETArC   s    r9   rD   zDeployBeta.Args   s     ))../r;   NrT   rU   rV   rW   rX   rD   rY   r;   r9   r[   r[      s    10 0r;   r[   c                        e Zd ZdZed        Zy)DeployAlphar>   c                 v    t        | t        j                  j                         t	        j
                  |        yr]   )r:   r   rA   ALPHAr   AddBuildpackStackFlagrC   s    r9   rD   zDeployAlpha.Args   s*     ))//0 
'r;   Nr_   rY   r;   r9   ra   ra      s    1( (r;   ra   EXAMPLESa          To deploy a function that is triggered by write events on the document
        ``/messages/{pushId}'', run:

          $ {command} my_function --runtime=python37 --trigger-event=providers/cloud.firestore/eventTypes/document.write --trigger-resource=projects/project_id/databases/(default)/documents/messages/{pushId}

        See https://cloud.google.com/functions/docs/calling for more details
        of using other types of resource as triggers.
        N)&rW   
__future__r   r   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.functionsr   r   r	   .googlecloudsdk.command_lib.functions.v1.deployr
   rF   r   .googlecloudsdk.command_lib.functions.v2.deployrR   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   _HOW_TO_DISABLE_CHANGE_LEARN_ABOUT_GEN_DIFFSrQ   r:   ReleaseTracksrA   rB   FunctionResourceCommandCommandr=   r^   r[   rc   ra   DETAILED_HELPdetailed_helprY   r;   r9   <module>rt      s@   2 &  ' ( 6 ? 5 P F P H P #B L ; b  H1V D%%(()5T))4<< 5 *5" D%%**+0 0 ,0 D%%++,	(* 	( -	(  
 % (
 ) r;   