
    !                        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 e
j"                   e
j$                  e
j&                  j(                  e
j&                  j*                  e
j&                  j,                         G d de
j.                                      Zdddde_        y)zACommand for starting instances owned by a managed instance group.    )absolute_import)division)unicode_literals)base_classes)instance_groups_utils)arg_parsers)base)flags)scopec                   &    e Zd ZdZed        Zd Zy)StartInstancesz2Start instances owned by a managed instance group.c                     | j                   j                  d       | j                  dt        j                  d      ddd       t
        j                  j                  |        y )	Nzp
        table(project(),
              zone(),
              instanceName:label=INSTANCE,
              status)z--instances   )
min_lengthINSTANCETzNames of instances to start.)typemetavarrequiredhelp)display_info	AddFormatadd_argumentr   ArgListinstance_groups_flags%MULTISCOPE_INSTANCE_GROUP_MANAGER_ARGAddArgument)parsers    >lib/surface/compute/instance_groups/managed/start_instances.pyArgszStartInstances.Args%   sb    
!! # 
 (00A> *!%;	  =
 ??KK    c                 z   t        j                  | j                               }|j                  }t        j
                  }t        j                  j                  }t        j                  |      }|j                  ||j                  ||      }|j                         dk(  r^d}|j                  j                  |j!                         |j                  j#                  g       |j$                  |j&                        }	n|j                         dk(  r^d}|j                  j)                  |j!                         |j                  j+                  g       |j$                  |j,                        }	n(t/        d	j1                  |j                                     t3        j4                  |d
|	|||j6                        S )N)default_scopescope_listerzcompute.instanceGroupManagers*instanceGroupManagersStartInstancesRequest)	instances)instanceGroupManagerr$   projectzonez#compute.regionInstanceGroupManagers0regionInstanceGroupManagersStartInstancesRequest)r&   r)   r'   regionzUnknown reference type {0}r   )
api_holdermethod_namerequest_templateinstances_holder_fieldigm_refr%   )r   ComputeApiHolderReleaseTrackclientr   r   compute_scope	ScopeEnumZONEr
   GetDefaultScopeListerResolveAsResource	resources
Collectionmessages1ComputeInstanceGroupManagersStartInstancesRequestName*InstanceGroupManagersStartInstancesRequestr'   r(   7ComputeRegionInstanceGroupManagersStartInstancesRequest0RegionInstanceGroupManagersStartInstancesRequestr*   
ValueErrorformatr   *SendInstancesRequestsAndPostProcessOutputsr%   )
selfargsholderr2   resource_argr"   r#   r/   r.   requests
             r   RunzStartInstances.Run4   s   **4+<+<+>?F]]F(NNL!++00M..v6L,,#!	 - #G >>KQQ&||~5;__555C//|| R g 
			!F	FQWW&||~;A??;;b;I// X g 3::



  ! ! !KK$ 5.." "r    N)__name__
__module____qualname____doc__staticmethodr   rH    r    r   r   r      s    
 ; ("r    r   z8Start the stopped instances in a managed instance group.a  
        *{command}* starts one or more instances from a managed instance group,
thereby increasing the targetSize and reducing the targetStoppedSize of the
group.

The command returns the operation status per instance, which might be ``FAIL'',
``SUCCESS'', or ``MEMBER_NOT_FOUND''. ``MEMBER_NOT_FOUND'' is returned only for
regional groups when the gcloud command-line tool wasn't able to resolve the
zone from the instance name.
z      To start an instance from a managed instance group in the us-central1-a
      zone, run:

              $ {command} example-managed-instance-group --zone=us-central1-a \
              --instances=example-instance
    )briefDESCRIPTIONEXAMPLESN)rL   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   r	   "googlecloudsdk.command_lib.computer
   r   r3   2googlecloudsdk.command_lib.compute.instance_groupsr   UniverseCompatibleReleaseTracksr1   ALPHABETAGACommandr   detailed_helprN   r    r   <module>r^      s    H &  ' 7 @ / ( 4 E ] T..33T5F5F5I5I:"T\\ :" :"| H	  r    