File: //lib/google-cloud-sdk/lib/surface/compute/instances/__pycache__/stop.cpython-312.pyc
�
��C � � � d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm Z ddl
mZ dd lm
Z
dd
lmZ ddlmZ ddlmZ d
ddd�Ze
j* e
j, e
j. j0 e
j. j2 e
j. j4 � G d� 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 � e Zd ZdZed� � Zd� Zd� Zd� Zy)�Stopr
c � � t j j |� |j ddd dd� d�� t j
j
|� | j � t j j k( s+| j � t j j k( r|j dd dd �
� y y )Nz--discard-local-ssd�?Tc �d � t j | j � j � � S �N)�ast�literal_eval�lower�
capitalize)�xs �%lib/surface/compute/instances/stop.py�<lambda>zStop.Args.<locals>.<lambda>W s � �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.ArgsM s� � � ���#�#�F�+�
������� @�<� � ?� �O�O����'�����d�/�/�5�5�5������!2�!2�!7�!7�7����
"���(� � � 8r c �� � | j � t j j k( s+| j � t j j k( rV|j j |j |j � |j |j |j �� S |j j |j |j � |j |j �� S )N)�discardLocalSsd�instance�project�zone�noGracefulShutdown)r2 r3 r4 r5 )r+ r r, r- �messages�ComputeInstancesStopRequest�discard_local_ssd�Namer4 r5 �no_graceful_shutdown)�self�client�instance_ref�argss r �_CreateStopRequestzStop._CreateStopRequesti s� � �����t�0�0�6�6�6�����$�"3�"3�"8�"8�8�
�_�_�
8�
8��0�0��$�$�&��&�&�� � �!�6�6� 9� � � �?�?�6�6��.�.��"�"�$��$�$�
�
�
� 7� � r c
�| � |D �cg c], }|j j d| j |||� f��. c}S c c}w )Nr )�apitools_client� instancesr@ )r<