
    &                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SS	KJr  SS
KJr  SSKJr  SSKJr   " S S\
R"                  5      rg)z*The `app instances disable-debug` command.    )absolute_import)division)unicode_literals)appengine_api_client)env)instances_util)base)
properties)	resources)
console_io)progress_trackerc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	DisableDebug    a;  Disable debug mode for an instance.

When not in debug mode, SSH will be disabled on the VMs. They will be included
in the health checking pools.

Note that any local changes to an instance will be *lost* if debug mode is
disabled on the instance. New instance(s) may spawn depending on the app's
scaling settings.
EXAMPLESz          To disable debug mode for a particular instance, run:

              $ {command} --service=s1 --version=v1 i1

          To disable debug mode for an instance chosen interactively, run:

              $ {command}
          c                 j    U R                  SSSS9  U R                  SSSS9  U R                  S	S
SS9  g )Ninstance?z        The instance ID to disable debug mode on. If not specified,
        select instance interactively. Must uniquely specify (with other
        flags) exactly one instance)nargshelpz	--servicez-sz        If specified, only match instances belonging to the given service.
        This affects both interactive and non-interactive selection.)r   z	--versionz-vz        If specified, only match instances belonging to the given version.
        This affects both interactive and non-interactive selection.)add_argument)parsers    *lib/surface/app/instances/disable_debug.pyArgsDisableDebug.Args7   sa    
#'  ( TH  I TH  I    c                    [         R                  " U R                  5       5      n[        UR	                  UR
                  UR                  S S95      n [        R                  R                  UR                  5      n[        R                  " X4R                  UR                  UR                  S9n["        R$                  " SR'                  U5      SS9  SR'                  U5      n[        R                  R                  UR(                  [*        R,                  R.                  R0                  R2                  UR
                  UR                  S.S	S
9n[4        R6                  " U5         UR9                  U5        S S S 5        g ! [          a8    [        R                  " X1R
                  UR                  UR                  S9n GNf = f! , (       d  f       g = f)Nc                 \    U R                   [        R                  [        R                  4;   $ )N)environmentr   FLEXMANAGED_VMS)vs    r   <lambda>"DisableDebug.Run.<locals>.<lambda>P   s    388S__2M!Mr   )version_filter)serviceversionr   zAbout to disable debug mode for instance [{0}].

Any local changes will be LOST. New instance(s) may spawn depending on the app's scaling settings.T)cancel_on_noz'Disabling debug mode for instance [{0}])appsId
servicesId
versionsIdz*appengine.apps.services.versions.instances)params
collection)r   GetApiClientForTrackReleaseTracklistGetAllInstancesr&   r'   r   REGISTRYParser   r   GetMatchingInstancer*   r+   instancesId	Exceptionr   PromptContinueformatidr
   VALUEScoreproject	GetOrFailr   ProgressTrackerDeleteInstance)selfargs
api_clientall_instancesresr   messages          r   RunDisableDebug.RunL   s   %::4;L;L;NOJ33dllM 4 O PM$$$T]]3c  33
??$h 	**0&*:O 8>>xHG



"
" '',,44>>"**"**

 @ # AC 
	)	)'	2$ 
3	23  "  33
t||=="h"2 
3	2s   )F *G
>GG

G N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   rF   __static_attributes__rH   r   r   r   r       s3      
- I I(!%r   r   N)rM   
__future__r   r   r   googlecloudsdk.api_lib.appr   r   r   googlecloudsdk.callioper	   googlecloudsdk.corer
   r   googlecloudsdk.core.consoler   r   Commandr   rH   r   r   <module>rW      s=     1 &  ' ; * 5 ( * ) 2 8M%4<< M%r   