
    U                         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  \	R$                  " \	R&                  R(                  5       " S S\	R*                  5      5       rg)z@Command for setting instance template of managed instance group.    )absolute_import)division)unicode_literals)base_classes)managed_instance_groups_utils)base)flags)scope)standby_policy_utilsc                   4    \ rS rSrSr\S 5       rS rS rSr	g)SetStandbyPolicyAlpha   zSet the standby policy for a managed instance group.

  *{command}* sets the fields in the standby policy for a managed instance
group. The standby policy dictates the behaviour of standby (stopped and
suspended) instances
c                 n    [         R                  " U 5        [        R                  R	                  U 5        g )N)r   AddStandbyPolicyArgsinstance_groups_flags%MULTISCOPE_INSTANCE_GROUP_MANAGER_ARGAddArgument)parsers    Alib/surface/compute/instance_groups/managed/set_standby_policy.pyArgsSetStandbyPolicyAlpha.Args'   s'    --f5??KK    c                    [         R                  " U R                  5       5      nUR                  n[        R
                  n[        R                  R                  n[        R                  " U5      nUR                  UUR                  UUS9nUR                  =(       d    S n[        R                  " UR                   US9n	U	(       d  g U R#                  X7U	5      $ )N)default_scopescope_lister)initial_delay_sec)r   ComputeApiHolderReleaseTrackclientr   r   compute_scope	ScopeEnumZONEr	   GetDefaultScopeListerResolveAsResource	resourcesinitial_delayr   CreateStandbyPolicymessages_MakePatchRequest)
selfargsholderr   resource_argr   r   igm_refr   standby_policys
             r   RunSetStandbyPolicyAlpha.Run-   s    **4+<+<+>?F]]F(NNL!++00M..v6L,,#!	 - #G
 **2d2FF+<N !!&>BBr   c                    UR                   nUR                  US9nUR                  5       S:X  a#  UR                  R                  nUR
                  nO_UR                  5       S:X  a#  UR                  R                  nUR                  nO([        SR                  UR                  5       5      5      eU" S0 UR                  5       D6nXXl        UR                  USU4/5      $ )N)standbyPolicyzcompute.instanceGroupManagersz#compute.regionInstanceGroupManagerszUnknown reference type {0}Patch )r(   InstanceGroupManager
Collectionapitools_clientinstanceGroupManagers(ComputeInstanceGroupManagersPatchRequestregionInstanceGroupManagers.ComputeRegionInstanceGroupManagersPatchRequest
ValueErrorformatAsDictinstanceGroupManagerResourceMakeRequests)	r*   r   r.   r/   r(   igm_resourceservicerequest_typerequests	            r   r)   'SetStandbyPolicyAlpha._MakePatchRequestB   s    H00~0NL>>&&<<gFFl				!F	F&&BBgLLl3::



  ! ! .W^^-.G+7('7 ;<==r   r5   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r0   r)   __static_attributes__r5   r   r   r   r      s&      
C*>r   r   N)rK   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r
   r    2googlecloudsdk.command_lib.compute.instance_groupsr   :googlecloudsdk.command_lib.compute.managed_instance_groupsr   ReleaseTracksr   ALPHACommandr   r5   r   r   <module>rW      s_    G &  ' 7 H ( 4 E ] [ D%%++,5>DLL 5> -5>r   