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__/suspend.cpython-312.pyc
�

��,��r�dZddlmZddlmZddlmZddlZddlmZddlm	Z	ddl
mZdd	lm
Z
dd
lmZddlmZddlmZd
ddd�Ze
j(e
j*j,e
j*j.e
j*j0�Gd�de
j2��Zee_y)z#Command for suspending an instance.�)�absolute_import)�division)�unicode_literalsN)�base_classes)�poller)�waiter)�base)�flags)�
exceptions)�logz#Suspend a virtual machine instance.a        *{command}* is used to suspend a Compute Engine virtual machine.
        Suspending a VM is the equivalent of sleep or standby mode: the guest
        receives an ACPI S3 suspend signal, after which all VM state is saved to
        temporary storage. An instance can only be suspended while it is in the
        RUNNING state. A suspended instance will be put in SUSPENDED state.

        Note: A suspended instance can be resumed by running the gcloud compute
        instances resume command.

        If a VM has any attached Local SSD disks, you can preserve the Local SSD
        data when you suspend the VM by setting `--discard-local-ssd=False`.
        Preserving the Local SSD disk data incurs costs and is subject to
        limitations.

        Limitations:

         - Limitations for suspending a VM: https://cloud.google.com/compute/docs/instances/suspend-resume-instance#limitations
         - Limitations for preserving Local SSD data: https://cloud.google.com/compute/docs/disks/local-ssd#stop_instance
        a@        To suspend an instance named ``test-instance'', run:

          $ {command} test-instance

        To suspend 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�,�eZdZdZed��Zd�Zd�Zy)�Suspenda�Suspend a virtual machine instance.

  *{command}* is used to suspend a Compute Engine virtual machine.
  Suspending a VM is the equivalent of sleep or standby mode:
  the guest receives an ACPI S3 suspend signal, after which all VM state
  is saved to temporary storage.  An instance can only be suspended while
  it is in the RUNNING state.  A suspended instance will be put in
  SUSPENDED state.

  Note: A suspended instance can be resumed by running the
  `gcloud compute instances resume` command.

  Limitations: See this feature's restrictions at
  https://cloud.google.com/compute/docs/instances/suspend-resume-instance#limitations
  c��tjj|�|jddddd�d��tj
j
|�y)Nz--discard-local-ssd�?Tc�d�tj|j�j��S�N)�ast�literal_eval�lower�
capitalize)�xs �(lib/surface/compute/instances/suspend.py�<lambda>zSuspend.Args.<locals>.<lambda>cs��s�'�'����	�(<�(<�(>�?�z,If set to true, local SSD data is discarded.)�nargs�default�const�type�help)r
�
INSTANCES_ARG�AddArgument�add_argumentr	�
ASYNC_FLAG�AddToParser)�cls�parsers  r�ArgszSuspend.ArgsYsR��	���#�#�F�+�
�������@�<��?�	�O�O����'rc��|jj||j�|j|j��S)N)�discardLocalSsd�instance�project�zone)�messages�ComputeInstancesSuspendRequest�Namer.r/)�self�client�instance_ref�discard_local_ssds    r�_CreateSuspendRequestzSuspend._CreateSuspendRequestgs?���?�?�9�9�)��"�"�$��$�$�
�
�
�	:� � rc
��tj|j��}|j}tj
j
||jt	j|���}g}|D]E}|j|jjd|j|||j�f��Gg}|j||�}|rtj |��|D�	cgc]'}	|jj#|	j$���)}
}	|j&rd|
D]>}t(j*j-dj/|j1����@t(j*j-d�|St3j4||jj|�}t7j8|t3j:|
�dj/dj=d�|D���d��}
|D]0}t(j*j-d	j/|���2|
Scc}	w)
N)�scope_listerrz&Suspend instance in progress for [{}].z]Use [gcloud compute operations describe URI] command to check the status of the operation(s).zSuspending instance(s) {0}z, c3�<K�|]}|j����y�wr)r2)�.0�is  r�	<genexpr>zSuspend.Run.<locals>.<genexpr>�s����6-�+��A�F�F�H�m�s�)�max_wait_mszUpdated [{0}].)r�ComputeApiHolder�ReleaseTrackr4r
r#�ResolveAsResource�	resources�GetInstanceZoneScopeLister�append�apitools_client�	instancesr7r6�
AsyncRequestsr�
MultiError�Parse�selfLink�async_r�status�Print�format�SelfLinkr�BatchPollerr�WaitFor�OperationBatch�join)r3�args�holderr4�
instance_refs�requestsr5�errors_to_collect�	responses�r�operation_refs�
operation_ref�operation_poller�results              r�RunzSuspend.Runns��
�
*�
*�4�+<�+<�+>�
?�F�
�]�]�F��'�'�9�9������5�5�f�=�:�?�M�
�H�%���o�o�v�-�-�7�7���1�1�&�,�26�2H�2H�J�K�L�&�
���$�$�X�/@�A�I���!�!�"3�4�4�BK�L�)�Q�f�&�&�,�,�Q�Z�Z�8�)�N�L��{�{�)�-��
�
���A�H�H��"�"�$�&�	'�*�
�j�j���(�)����)�)�&�*0�*@�*@�*J�*J�*7�9���^�^�����n�-�$�+�+�D�I�I�6-�+�6-�--�	.���F�&��	�j�j���'�.�.�|�<�=�&��M��3Ms�*,H;N)�__name__�
__module__�__qualname__�__doc__�classmethodr*r7r_�rrrrFs%��� �(��(� �-rr)rc�
__future__rrrr�googlecloudsdk.api_lib.computer�)googlecloudsdk.api_lib.compute.operationsr�googlecloudsdk.api_lib.utilr�googlecloudsdk.callioper	�,googlecloudsdk.command_lib.compute.instancesr
�googlecloudsdk.corerr�
DETAILED_HELP�
ReleaseTracksr@�ALPHA�BETA�GA�
SilentCommandr�
detailed_helprerr�<module>rts���*�&��'�
�7�<�.�(�>�*�#�	.�	�*
	
�3$�
�N����D�%�%�+�+�T�->�->�-C�-C��%�%�(�(�*�S�d� � �S�*�S�l&��r