HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/surface/compute/instances/__pycache__/stop.cpython-312.pyc
�

��C���dZddlmZddlmZddlmZddlZddlmZddlm	Z	ddl
mZdd	lm
Z
dd
lmZddlmZddlmZd
ddd�Ze
j*e
j,e
j.j0e
j.j2e
j.j4�Gd�de
j6���Zee_y)z!Command for stopping an instance.�)�absolute_import)�division)�unicode_literalsN)�base_classes)�poller)�waiter)�base)�flags)�
exceptions)�log� Stop a virtual machine instance.au        *{command}* is used to stop a Compute Engine virtual machine.
        Stopping a VM performs a clean shutdown, much like invoking the shutdown
        functionality of a workstation or laptop.

        If a VM has any attached Local SSD disks, you must use the
        `--discard-local-ssd` flag to indicate whether or not the Local SSD
        data should be discarded. To stop the VM and preserve the Local SSD
        data when you stop the VM by setting `--discard-local-ssd=False`.

        To stop the VM and discard the Local SSD data, specify
        `--discard-local-ssd=True`.

        Preserving the Local SSD disk data incurs costs and is subject to
        limitations. See
        https://cloud.google.com/compute/docs/disks/local-ssd#stop_instance
        for more information.

        Stopping a VM which is already stopped will return without errors.
        a6        To stop an instance named `test-instance`, run:

          $ {command} test-instance

        To stop an instance named `test-instance` that has a Local SSD, run:

          $ {command} test-instance --discard-local-ssd=True

        Using '--discard-local-ssd' without a value defaults to True.
      )�brief�DESCRIPTION�EXAMPLESc�2�eZdZdZed��Zd�Zd�Zd�Zy)�Stopr
c��tjj|�|jddddd�d��tj
j
|�|j�tjjk(s+|j�tjjk(r|jdddd	�
�yy)Nz--discard-local-ssd�?Tc�d�tj|j�j��S�N)�ast�literal_eval�lower�
capitalize)�xs �%lib/surface/compute/instances/stop.py�<lambda>zStop.Args.<locals>.<lambda>Ws��s�'�'����	�(<�(<�(>�?�z,If set to true, local SSD data is discarded.)�nargs�default�const�type�helpz--no-graceful-shutdown�
store_truez�Stops the instance immediately without gracefully shutting it down. If a graceful shutdown is in progress, then the instance is forcefully stopped.)r �actionr#)
r
�
INSTANCES_ARG�AddArgument�add_argumentr	�
ASYNC_FLAG�AddToParser�ReleaseTrack�ALPHA�BETA)�cls�parsers  r�Argsz	Stop.ArgsMs���	���#�#�F�+�
�������@�<��?�	�O�O����'�����d�/�/�5�5�5������!2�!2�!7�!7�7����
"���(��	�8rc���|j�tjjk(s+|j�tjjk(rV|jj|j|j�|j|j|j��S|jj|j|j�|j|j��S)N)�discardLocalSsd�instance�project�zone�noGracefulShutdown)r2r3r4r5)r+r	r,r-�messages�ComputeInstancesStopRequest�discard_local_ssd�Namer4r5�no_graceful_shutdown)�self�client�instance_ref�argss    r�_CreateStopRequestzStop._CreateStopRequestis�������t�0�0�6�6�6�����$�"3�"3�"8�"8�8�
�_�_�
8�
8��0�0��$�$�&��&�&�� � �!�6�6�9����?�?�6�6��.�.��"�"�$��$�$�
�
�
�	7��rc
�|�|D�cgc],}|jjd|j|||�f��.c}Scc}w)Nr)�apitools_client�	instancesr@)r<r=�
instance_refsr?r>s     r�_CreateRequestszStop._CreateRequests|sO��!.�/� -���
#�
#�
-�
-�v�
�
$�
$�V�\�4�
@�
B� -�/�/��/s�19c
��tj|j��}|j}tj
j
||jt	j|���}|j|||�}g}|j||�}|rtj|��|D�cgc]'}|jj|j���)}	}|jrd|	D]>}
t j"j%dj'|
j)����@t j"j%d�|St+j,||j.j0|�}t3j4|t+j6|	�dj'dj9d�|D���d��|D]0}t j"j%dj'|���2ycc}w)	N)�scope_listerz#Stop instance in progress for [{}].z]Use [gcloud compute operations describe URI] command to check the status of the operation(s).zStopping instance(s) {0}z, c3�<K�|]}|j����y�wr)r:)�.0�is  r�	<genexpr>zStop.Run.<locals>.<genexpr>�s����4-�+��A�F�F�H�m�s�)�max_wait_mszUpdated [{0}].)r�ComputeApiHolderr+r=r
r&�ResolveAsResource�	resources�GetInstanceZoneScopeListerrE�
AsyncRequests�core_exceptions�
MultiError�Parse�selfLink�async_r�status�Print�format�SelfLinkr�DeleteBatchPollerrBrCr�WaitFor�OperationBatch�join)
r<r?�holderr=rD�requests�errors_to_collect�	responses�r�operation_refs�
operation_ref�operation_pollerr>s
             r�RunzStop.Run�s���
�
*�
*�4�+<�+<�+>�
?�F�
�]�]�F��'�'�9�9������5�5�f�=�:�?�M�
�#�#�F�M�4�@�H����$�$�X�/@�A�I���&�&�'8�9�9�BK�L�)�Q�f�&�&�,�,�Q�Z�Z�8�)�N�L��{�{�)�-��
�
���>�E�E��"�"�$�&�	'�*�
�j�j���(�)����/�/���&�&�0�0�-����N�N�����n�-�"�)�)�$�)�)�4-�+�4-�+-�	.���&��	�j�j���'�.�.�|�<�=�&��3Ms�1,HN)	�__name__�
__module__�__qualname__�__doc__�classmethodr0r@rErg�rrrrFs(��
)�����6�&/�
*>rr)rk�
__future__rrrr�googlecloudsdk.api_lib.computer�)googlecloudsdk.api_lib.compute.operationsr�googlecloudsdk.api_lib.utilr�googlecloudsdk.callioper	�,googlecloudsdk.command_lib.compute.instancesr
�googlecloudsdk.corerrRr�
DETAILED_HELP�UniverseCompatible�
ReleaseTracksr+r,�GAr-�
SilentCommandr�
detailed_helprmrr�<module>r{s���(�&��'�
�7�<�.�(�>�=�#�	+�	�*
	
�3$�
�N������������T�.�.�1�1�4�3D�3D�3I�3I��a>�4���a>���a>�H#��r