File: //lib/google-cloud-sdk/lib/surface/compute/instances/__pycache__/suspend.cpython-312.pyc
�
��, � �r � d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm Z ddl
mZ dd lm
Z
dd
lmZ ddlmZ ddlmZ d
ddd�Z e
j( e
j* j, e
j* j. e
j* j0 � G d� 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 �, � e Zd ZdZed� � 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 � � t j j |� |j ddd dd� d�� t j
j
|� y )Nz--discard-local-ssd�?Tc �d � t j | j � j � � S �N)�ast�literal_eval�lower�
capitalize)�xs �(lib/surface/compute/instances/suspend.py�<lambda>zSuspend.Args.<locals>.<lambda>c s � �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 �ArgszSuspend.ArgsY sR � � ���#�#�F�+�
������� @�<� � ?� �O�O����'r c � � |j j ||j � |j |j �� S )N)�discardLocalSsd�instance�project�zone)�messages�ComputeInstancesSuspendRequest�Namer. r/ )�self�client�instance_ref�discard_local_ssds r �_CreateSuspendRequestzSuspend._CreateSuspendRequestg s? � ��?�?�9�9�)��"�"�$��$�$�
�
�
� :� � r c
� � t j | j � � }|j }t j
j
||j t j |� �� }g }|D ]E }|j |j j d| j |||j � f� �G g }|j ||� }|rt j |� �|D � cg c]'