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: //usr/lib/google-cloud-sdk/lib/surface/compute/disks/__pycache__/create.cpython-312.pyc
�

��
��	��dZddlmZddlmZddlmZddlZddlZddlZddlm	Z	m
Z
ddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZdd
lmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlmZ!ddl"mZ#ddl"m$Z%ddl&m'Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/Z/dddd�Z0	d4d�Z1							d5d �Z2d!�Z3d"�Z4d#e
e5d$e
e5fd%�Z6d&ejnd'e	d(e
e5d$e
e5fd)�Z8d&ejnd'e	d$e
e5fd*�Z9d&ejnd'e	d$e
e5fd+�Z:ejvejxejzj|�Gd,�d-ej~���Z@ejvejxejzj��Gd.�d/e@���ZBejvejxejzj��Gd0�d1eB���ZDd2�ZEd3�ZFe0e@_Gy)6zCommand for creating disks.�)�absolute_import)�division)�unicode_literalsN)�Any�Optional)�base_classes)�	constants)�
csek_utils)�
disks_util)�image_utils)�	kms_utils)�utils)�
zone_utils)�arg_parsers)�base)�
exceptions)�
completers)�flags)�scope)�create)�util)�
resource_args)�	arg_utils)�labels_util)�logz&Create Compute Engine persistent disksa8        *{command}* creates one or more Compute Engine
        persistent disks. When creating virtual machine instances,
        disks can be attached to the instances through the
        `gcloud compute instances create` command. Disks can also be
        attached to instances that are already running using
        `gcloud compute instances attach-disk`.

        Disks are zonal resources, so they reside in a particular zone
        for their entire lifetime. The contents of a disk can be moved
        to a different zone by snapshotting the disk (using
        `gcloud compute disks snapshot`) and creating a new disk using
        `--source-snapshot` in the desired zone. The contents of a
        disk can also be moved across project or zone by creating an
        image (using `gcloud compute images create`) and creating a
        new disk using `--image` in the desired project and/or
        zone.

        For a comprehensive guide, including details on minimum and maximum
        disk size, refer to:
        https://cloud.google.com/compute/docs/disks
        z�        When creating disks, be sure to include the `--zone` option. To create
        disks 'my-disk-1' and 'my-disk-2' in zone us-east1-a:

          $ {command} my-disk-1 my-disk-2 --zone=us-east1-a
        )�brief�DESCRIPTION�EXAMPLESc��|j�}|j�}d�}|jd|��tj|�|jdd��tj
|�|r"tjj||��ntjj|�|rt
j|�tjj|�tjj||��tjj||��t
j|�t
j|�y)z#Add mutually exclusive source args.c�
�d}|S)z-Returns detailed help for `--image` argument.a=        An image to apply to the disks being created. When using
        this option, the size of the disks must be at least as large as
        the image size. Use ``--size'' to adjust the size of the disks.

        This flag is mutually exclusive with ``--source-snapshot'' and
        ``--image-family''.
        �)�templates �#lib/surface/compute/disks/create.py�AddImageHelpz!_SourceArgs.<locals>.AddImageHelp`s���H��O�z--image��helpz--image-familya�        The image family for the operating system that the boot disk will be
        initialized with. Compute Engine offers multiple Linux
        distributions, some of which are available as both regular and
        Shielded VM images.  When a family is specified instead of an image,
        the latest non-deprecated image associated with that family is
        used. It is best practice to use --image-family when the latest
        version of an image is needed.
        )�mutex_groupN)�	add_group�add_mutually_exclusive_group�add_argumentr�AddImageProjectFlag�AddImageFamilyScopeFlag�disks_flags�SOURCE_SNAPSHOT_ARG_ALPHA�AddArgument�SOURCE_SNAPSHOT_ARG�AddSourceInstantSnapshotProject�SOURCE_INSTANT_SNAPSHOT_ARG�SOURCE_DISK_ARG�ASYNC_PRIMARY_DISK_ARG�AddPrimaryDiskProject�AddLocationHintArg)�parser�support_source_snapshot_region�source_instant_snapshot_enabled�source_parent_group�source_groupr$s      r#�_SourceArgsr=Ws'���(�(�*��$�A�A�C�,�
����I�L��9�
�!�!�"5�6�������

��%�%�&9�:�#��)�)�5�5��L�6���#�#�/�/��=�$��/�/��7�
�)�)�5�5�l�C�
���)�)�&�l�)�K�
�$�$�0�0��,�1���#�#�F�+�
� � ��(r%c	�x�tjj|d��|jdd��|jdt	j
dgd��	�d
j
tjtjtjtjtjtjtjtj���|jdtjd
��|r|jdd��|jj!d�|jdt	j"�dd��t%|||�t'j(|t�t'j*||�t'j,|t�t&j.j|�t'j0||�|r*t'j2|�t'j4|�|r'|jdt	j"�dd��t7j8|�t;j<|�|r|jdddgdd��|rt?j@|d��tCjD|dd �y!)"z5Add arguments used for parsing in all command tracks.r)�operation_typez
--descriptionz=An optional, textual description for the disks being created.r&�--size�1GB)�GB�GiB�TB�TiB�PiB�PB)�lower_bound�suggested_binary_size_scalesaW        Size of the disks. The value must be a whole
        number followed by a size unit of ``GB'' for gigabyte, or ``TB''
        for terabyte. If no size unit is specified, GB is
        assumed. For example, ``10GB'' will produce 10 gigabyte
        disks. Disk size must be a multiple of 1 GB. If disk size is
        not specified, the default size of {}GB for pd-standard disks, {}GB for
        pd-balanced disks, {}GB for pd-ssd disks, and {}GB for pd-extreme will
        be used. For details about disk size limits, refer to:
        https://cloud.google.com/compute/docs/disks
        )�typer'z--typez�      Specifies the type of disk to create. To get a
      list of available disk types, run `gcloud compute disk-types list`.
      The default disk type is pd-standard.
      )�	completerr'z--interfacez�        Specifies the disk interface to use for attaching this disk. Valid values
        are `SCSI` and `NVME`. The default is `SCSI`.
        z=table(name, zone.basename(), sizeGb, type.basename(), status)z
--licenses�LICENSEz�A list of URIs to license resources. The provided licenses will be added onto the created disks to indicate the licensing and billing policies.�rJ�metavarr'z--user-licensesz^List of URIs to license resources. User-provided licenses can be edited after disk is created.z--physical-block-size�4096�16384z_Physical block size of the persistent disk in bytes.
Valid values are 4096(default) and 16384.
)�choices�defaultr'za source snapshot)�resourcezadded to�diskN)#�Create�	disks_argr0r+r�
BinarySize�formatr	�DEFAULT_DISK_SIZE_GB_MAP�DISK_TYPE_PD_STANDARD�DISK_TYPE_PD_BALANCED�DISK_TYPE_PD_SSD�DISK_TYPE_PD_EXTREMEr�DiskTypesCompleter�display_info�	AddFormat�ArgListr=r.�AddProvisionedIopsFlag�AddArchitectureFlag�AddProvisionedThroughputFlag�STORAGE_POOL_ARG�AddAccessModeFlag�AddSourceMachineImageNameArg�&AddSourceMachineImageDiskDeviceNameArgr
�AddCsekKeyArgsr�AddCreateLabelsFlagsr�AddEraseVssSignature�resource_flags�AddResourcePoliciesArgs)	�messagesr8�#include_physical_block_size_support�vss_erase_enabled�support_pd_interface�support_user_licensesr9�support_gmi_restorer:s	         r#�_CommonArgsrt�sw��	�����v�h��?�����J��L�	�����!�!��'N�P�
�
�F��.�.�y�/N�/N�O��.�.�y�/N�/N�O��.�.�y�/I�/I�J��.�.�y�/M�/M�N�	
P��Q�*	�����-�-�
����
������
�	�����E�G�	������� ����	���,�.M���$�$�V�[�9�
�!�!�&�(�3�
�*�*�6�;�?�
���*�*�6�2�
�����1���,�,�V�4��6�6�v�>��
����
�
 �
 �
"��5�	�7�
���F�#�
�"�"�6�*�(�
������!���	���	���v�0C�D��(�(���V�Dr%c�X�|jdtjdd��dd��y)N�--replica-zones�)�
min_length�
max_length�ZONEz�A comma-separated list of exactly 2 zones that a regional disk will be replicated to. Required when creating regional disk. The zones must be in the same region as specified in the `--region` flag. See available zones with `gcloud compute zones list`.rM)r+rra)r8s r#�_AddReplicaZonesArgr{�s0���������!��:��
+�	�-r%c���g}|jrT|jD]E}|jj|�}|j�}||_|j	|��G|S)zParse GuestOS features.)�guest_os_features�GuestOsFeature�TypeValueValuesEnumrJ�append)�args�client_messages�guest_os_feature_messages�feature�gf_type�guest_os_features      r#�_ParseGuestOsFeaturesToMessagesr�
sf�� ��	����)�)���.�.�B�B�7�K�g�(�7�7�9��%����&�&�'7�8�	*�
#�"r%�source_instant_snapshot�returnc�^�|sytjd|�}|r|jd�SdS)z7Gets the source instant-snapshot project from the path.Nzprojects/([^/]+)�)�re�search�group)r��matchs  r#�(_GetSourceInstantSnapshotProjectFromPathr�s1��
!��
�)�)�'�)@�
A�%� ����Q��*�d�*r%r��compute_holder�source_projectc��tjj||j|��}|r|j	�SdS)z1Resolves the instant snapshot reference to a URI.�r�N)r.r3�ResolveAsResource�	resources�SelfLink)r�r�r��instant_snapshot_refs    r#�_GetInstantSnapshotReferencer�!sL��
�-�-�?�?�
�
�
"�
"�'�@���-A�	�	&�	&�	(�J�d�Jr%c���t|dd�}t|j�}|r||k7rtjdd��|r||k(r
t|||�S|st|||��Sy)z?Gets the URI when source_instant_snapshot_project is specified.�source_instant_snapshot_projectNz!--source_instant_snapshot_projectz�The project specified in --source-instant-snapshot-project does not match the project in the --source-instant-snapshot URI. Please ensure these values are consistent.r�)�getattrr�r�r�BadArgumentExceptionr�)r�r��actual_source_project�expected_source_projects    r#�6_GetSourceInstantSnapshotUriWithSourceProjectSpecifiedr�/s���"�$�(I�4�P��D�
�"�"���
�
�#:�
:��
)�
)�+�	6����
�#:�
:�'��n�3���#�'��n�-B���
r%c�h�|jr&t|dd�s
t||d�St||�Sy)z+Determines the source instant snapshot URI.r�N)r�r�r�r�)r�r�s  r#�_GetSourceInstantSnapshotUrir�Rs@��
�!�!��4�:�D�A�
)�$���
E�E�A��n���
r%c��eZdZdZed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zedd��Zd�Z									dd�Zdd�Zy)rU�'Create Compute Engine persistent disks.c�B�|jd��jj}tjd��t
_t||�tj||�t|�tj|dd��tj|�y)NT��no_http��pluralrT��region_fallthrough)�
_GetApiHolder�clientrnr.�MakeDiskArgrUrVrtr�AddGuestOsFeaturesArgr{�kms_resource_args�AddKmsKeyResourceArg� AddEnableConfidentialComputeFlag��clsr8rns   r#�ArgszCreate.Argsesy��� � �� �.�5�5�>�>�H�"�.�.�d�;�F����&�!��%�%�f�h�7�����*�*���4�1��0�0��8r%c�6�|jr|jSgS)z�Parse license.

    Subclasses may override it to customize parsing.

    Args:
      args: The argument namespace

    Returns:
      List of licenses.
    )�licenses��selfr�s  r#�
ParseLicenseszCreate.ParseLicensesps���}�}�
�]�]��
�Ir%c��t||�S�N)�(_ValidateAndParseDiskRefsRegionalReplica)r�r�r�s   r#�ValidateAndParseDiskRefszCreate.ValidateAndParseDiskRefss��3�D�.�I�Ir%c�6�|jxs|jSr�)�image�image_familyr�s  r#�GetFromImagezCreate.GetFromImage�s���:�:�*��*�*�*r%c��|jSr�)r�r�s  r#�GetFromSourceInstantSnapshotz#Create.GetFromSourceInstantSnapshot�s���'�'�'r%c�>�tj|j�}|rG|jtj
vr*|dkr%t
jddj|���n�|js|s|js|j|�rnh|jtjvrtj|j}n.|jrn!tjtj}tj||j�|S)N�
r@z=Value must be greater than or equal to 10 GB; reveived {0} GB)r�	BytesToGb�sizerJr	�LEGACY_DISK_TYPE_LISTr�InvalidArgumentExceptionrX�source_snapshot�source_diskr�rYrZ�WarnIfDiskSizeIsTooSmall)r�r��
from_image�size_gbs    r#�
GetDiskSizeGbzCreate.GetDiskSizeGb�s����o�o�d�i�i�(�G��
���i�5�5�	5�'�B�,��1�1��K�
�V�G�_�
�	
����������,�,�T�2��	
���i�8�8�	8��2�2�4�9�9�=�g�	
���
��2�2�
�
)�
)�+�g�	�"�"�7�D�I�I�6��Nr%c
��i}tj|j|j�}|D]�}|r�|j|vs�|j|j|j|j|jd|jd��\}}	tj�||j<|||j_��tj�||j<d||j_��|S)NFT)�user_projectr�r��
image_project�return_image_resource�image_family_scope�support_image_family_scope)
r�
ImageExpanderr�r��project�ExpandImageFlagr�r�r�r��argparse�	Namespace�uri)
r�r��	disk_refsr�r��project_to_source_image�image_expander�disk_ref�source_image_uri�_s
          r#�GetProjectToSourceImageDictz"Create.GetProjectToSourceImageDict�s��� �� �.�.�~�/D�/D�/=�/G�/G�I�N���	����#:�:� .� >� >�#�+�+��J�J��,�,� �.�.�$)�!%�!8�!8�)-�!?�!/�
�
�A�7?�6H�6H�6J�
!�(�"2�"2�
3�:J�
!�(�"2�"2�
3�
7�4<�4F�4F�4H��� 0� 0�1�8<��� 0� 0�1�5�� #�"r%c��tj|�}|jd�|D��tj|�}|jd�|D��y)Nc3�HK�|]}|j�dk(s�|���y�w)�
compute.disksN��
Collection��.0�refs  r#�	<genexpr>zBCreate.WarnAboutScopeDeprecationsAndMaintenance.<locals>.<genexpr>�s����I�	��S�^�^�%5��%H��	���"�"c3�HK�|]}|j�dk(s�|���y�w)�compute.regionDisksNr�r�s  r#r�zBCreate.WarnAboutScopeDeprecationsAndMaintenance.<locals>.<genexpr>�s ����O�	��S�^�^�%5�9N�%N��	�r�)r�ZoneResourceFetcher�WarnForZonalCreation�region_utils�RegionResourceFetcher�WarnForRegionalCreation)r�r�r��zone_resource_fetcher�region_resource_fetchers     r#�(WarnAboutScopeDeprecationsAndMaintenancez/Create.WarnAboutScopeDeprecationsAndMaintenance�sT��&�:�:�6�B���.�.�I�	�I�K�+�@�@��H���3�3�O�	�O�Qr%c�F�|s+tjj||j�}nbtjj||jtj|j�tjj��}|r|j�Sy)N)�scope_lister�
default_scope)r.r1r�r�r/r�GetDefaultScopeListerr��
compute_scope�	ScopeEnum�GLOBALr�)r�r�r�r9�snapshot_refs     r#�GetSnapshotUrizCreate.GetSnapshotUri�s���*� �4�4�F�F�
�
�
"�
"��l�
!�:�:�L�L�
�
�
"�
"��2�2�>�3H�3H�I�%�/�/�6�6�	M��l��
�
"�
"�
$�$�r%c��d}|jr�|jr+tjj	||j
�}n�|j
�dk(rEtjj	||j
tjj��}nW|j
�dk(rDtjj	||j
tjj��}|r|j�Sy)Nr��r�r�)r��source_disk_zoner.r4r�r�r�r�r�rz�REGIONr�)r�r�r�r��source_disk_refs     r#�GetSourceDiskUrizCreate.GetSourceDiskUri�s����O����	
�	�	�%�5�5�G�G��.�*�*�,����� �O�3�'�7�7�I�I���&�&�)�3�3�8�8�J�:�/��
 �
 �
"�&;�
;�'�7�7�I�I���&�&�)�3�3�:�:�J�<�/�
��'�'�)�)�r%c��d}|jrKt|dd�}tjj	||j
|��}|r|j
�Sy)N�primary_disk_projectr�)�primary_diskr�r.r5r�r�r�)r�r�r��primary_disk_refrs     r#�GetAsyncPrimaryDiskUrizCreate.GetAsyncPrimaryDiskUri�sc�������$�T�+A�4�H��$�;�;�M�M�
��(�(�9M�N���
��(�(�*�*�r%c���|jrVtjj||jt
jj��}|r|j�Sy)Nr)	�storage_poolr.rer�r�r�r�rzr�)r�r�r��storage_pool_refs    r#�GetStoragePoolUrizCreate.GetStoragePoolUrisZ�����$�5�5�G�G�
�
�
"�
"�%�/�/�4�4�H���

��(�(�*�*�r%c
�P�d}t|dd�}|r�|jjjt	tj|j��D��cgc]6\}}|jjjj||����8c}}��}|Scc}}w)N�labels)�key�value)�additionalProperties)	r�rn�Disk�LabelsValue�sorted�six�	iteritemsr�AdditionalProperty)r�r�r�r�args_labelsrrs       r#�	GetLabelszCreate.GetLabelss���
�F��$��$�/�K�����#�#�/�/�#�3�=�=����#=�>�F�?�j�c�5��/�/�
�
�
*�
*�
=�
=��U�>�$�>�F�/�	�f�
�M��Fs�;B"
c��g}|jD]K}|jj|dd|ji��}|j	|j���M|S)Nz
compute.zonesr�)�
collection�params)�
replica_zonesr��Parser�r�r�)r�r�r�r��result�zone�zone_refs       r#�GetReplicaZoneszCreate.GetReplicaZonessd��
�F��"�"���)�)�/�/�
�$��X�-�-�.�0�0�h�
�m�m�H�%�%�'�(�#��Mr%c�J�tj|j�|�Sr�)r�ComputeApiHolder�ReleaseTrack)r�r�s  r#r�zCreate._GetApiHolder#s���(�(��)9�)9�);�W�E�Er%c�(�|j|d��S)NT)�supports_kms_keys��_Runr�s  r#�Runz
Create.Run's���9�9�T�T�9�2�2r%c��|j�}|j}|jd�xs7|jd�xs$|jd�xs|jd�|_|jxr|jd�|_|j	||�}
|j|�}|j
||�}|j|
|�|j||
||�}|j|||	�}|j||�}tjj|d�}|D]G}||j}tj||j ||g|j"�||_�It'||j(�}g}|
D�]�}t+j,|j.||�}i}|r|j1||j2�}tj4||j"�}||d<||j6j$d|d	<||j6j$d
|d<|r||d<|r4t9j:||j(|j=dd��|d<|rM|j>rAtAjB|j>|j(jDjF�|d
<|jHr6|j(jK�}|jM||�|_'||d<|r'|jd�rtQ|jR�}nd}tU|dd�}|r�|jW�dk(r
|jX} nt[j\|j^�} g}!|D]N}"tajb|j |"|j6| ��}#|!je|#jg���P|!|d<|j(jDd)|ji�|jj||||j6j||d�|��}$|jm|||�|$_7tq||�|$_9|r4|jW�dvr"|jd�r|jt|$_;|r"|jd�r|jx|$_=|r||$_>|r"|jd�r|j~|$_@|j�|�|$_B|jd�r?|r't+j�|�r|j�|$_Ent�j�dd��|jd�r?|r't+j�|�r|j�|$_Jnt�j�dd��|jd�r |$j�|j��|$_L|jd �r |$j�|j��|$_O|r"|jd!�r|j�|$_Q|jd"�r|j�|$_S|jd#�r|j�||�|$_U|
rt�||$�|jW�d$k(rL|j(j�|$|j6|j^�%�}%|j"j�d&|%f}%n�|jW�dk(rt|jd'�r|j�|||�|$_Z|j(j�|$|j6|jX�(�}%|j"j�d&|%f}%|je%����|j�|�S)*Nr�r�r�r�r�T�diskEncryptionKeyr�sourceImageEncryptionKeyr��sourceSnapshotEncryptionKeyr�	interface�asyncPrimaryDisk�physical_block_size�resource_policiesr�)r��region�resourcePolicies)�name�description�sizeGb�sourceSnapshot�sourceImagerJ�physicalBlockSizeBytes)r�r��multi_writer�confidential_compute�erase_windows_vss_signature�provisioned_iopsz--provisioned-iopsz;--provisioned-iops cannot be used with the given disk type.�provisioned_throughputz--provisioned-throughputzA--provisioned-throughput cannot be used with the given disk type.�architecture�access_mode�
user_licenses�
location_hintr
r�)rTr�r#�Insertr )rTr�r6r!)^r�r��IsSpecified�show_unformated_messager�r�r�r�r�rrr
�CsekKeyStore�FromArgsr��MaybeLookupKeyMessagesByUrir��apitools_client�keysr�rnr�GetDiskTypeUrirJ�	LookupKey�require_csek_key_create�MaybeToMessager�r
�MaybeGetKmsKey�getr2r�ChoiceToEnumr�InterfaceValueValuesEnumr	�DiskAsyncReplicationrrT�intr4r�r�r6r�ZoneNameToRegionNamer#�
resource_util�ParseResourcePolicyr�r��Namer9r�
sourceDiskr��sourceInstantSnapshotr>�multiWriterr?�enableConfidentialCompute�guestOsFeaturesr@�eraseWindowsVssSignaturer�r��IsProvisioningTypeIopsrA�provisionedIopsrr��IsProvisioningTypeThroughputrB�provisionedThroughput�ArchitectureValueValuesEnumrC�AccessModeValueValuesEnumrD�
accessModerE�userLicensesrF�locationHintr�storagePool�_SetSourceMachineImageOptions�ComputeDisksInsertRequest�disksr%�replicaZones�ComputeRegionDisksInsertRequest�regionDisks�MakeRequests)&r�r�r*�supports_physical_block�support_multiwriter_disk�support_vss_eraserqrr�#support_enable_confidential_computer9rsr�r�r�r�r�r��snapshot_urir�	csek_keysr�r�r��requestsr��type_uri�kwargs�disk_key_or_none�disk_key_message_or_noner	�physical_block_size_bytesr5�disk_region�parsed_resource_policies�policy�resource_policy_refrT�requests&                                      r#r,zCreate._Run*sA���'�'�)�N�
�
"�
"�F�(,�(8�(8��(A�)H�(,�(8�(8��(H�)H�(,�(8�(8�9J�(K�)H�)-�(8�(8��(G�$I�D� �$(�#?�#?�$5����2�3�E5�D� ��-�-�d�N�C�I��"�"�4�(�J�� � ��z�2�G��1�1�)�V�D�"�>�>��i���5���&�&��n�<��L��^�^�D�&�
)�F��'�'�0�0��t�<�I�*��0��9�=�=��
�
0�
0���1�1���.��0F�0F�H��g�&�+�+�!@��f�o�o�!���H����*�*�4�9�9�h��O�h��f�	�$�.�.�x�/3�/K�/K�M��#-�#<�#<��f�4�4�$6� �&>��"�#�#�H�$4�$4�5�:�:�1�=�	�)�*�
$�H�$4�$4�5�:�:�1�=�	�,�-�	�!��x��	�&/�&>�&>��&�/�/�6�:�:�.A�4�#H�'J��"�#�
�$�.�.�'�4�4��N�N�F�O�O�0�0�I�I�K��{��
�	�	����;�;�=�� �7�7��n�M���%1��!�"�	 �T�%5�%5�6K�%L�$'��(@�(@�$A�!�$(�!�!�$�(;�T�B��	���� �$9�9� ���+��2�2�8�=�=�A�+�#%� �'�F� -� A� A��&�&���&�&� �	!"�
�
#�
)�
)�*=�*F�*F�*H�
I�
(�&>��!�"�
!�V�_�_�
!�
!���}�}���&�&��%�-�h�.>�.>�?�C�C��!:��
��d��-�-�d�H�n�M�d�o�#?�
��$ �d� �#�
�
�
�
�#K�
K�
�
�
�>�
*��,�,���	,��1A�1A�
 �2�*.�)B�)B��&�	"�8���	�t�/�/�0M�N�(,�(H�(H��%��(�(��.�d�m�	
�	�	�,�	-��
�9�9�(�C�!%�!6�!6�$�
��3�3�"�K�M�M�
�	�	�
"�
$��
�?�?��I�'+�'B�'B�$�
$��3�3�(����

�	�	�.�	)� �<�<�T�=N�=N�O���	
�	�	�-�	(��8�8��9I�9I�J���	�4�#3�#3�O�#D� �.�.���	
�	�	�/�	*� �.�.���	
�	�	�.�	)��1�1�$��G���	�%�d�D�1�	�	�	�	�/�	1��/�/�;�;��x�/�/�h�m�m�<�E���)�)�/�/��7�C����� �$9�9����O�,�"�2�2��N�H��$�
��/�/�A�A��x�/�/����B�I���)�)�5�5�x��I���o�o�g��S�V���x�(�(r%c��d}|jr3tjjt	j
|��yy)Nz�
        New disks are unformatted. You must format and mount a disk before it
        can be used. You can find instructions on how to do this at:

        https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting
        )rIr�status�Print�textwrap�dedent)r��resources_were_displayed�messages   r#�Epilogz
Create.Epilog�s4���G��#�#�	�j�j���x���w�/�0�$r%N�F)	FFFFFFTFF)T)�__name__�
__module__�__qualname__�__doc__�classmethodr�r�r�r�r�r�r�r�rrrrrr%r�r-r,r�r!r%r#rUrU`s���0��9��9�
�J�+�(�#�J#�2Q��&�*	�	�	���F��F�3��#�$�� �!�*.�%*��{)�z	1r%rUc�&�eZdZdZed��Zd�Zy)�
CreateBetar�c	�x�|jd��jj}tjd��t
_t||ddddd��tj||�t|�tj|dd��tj|�tj|�y)NTr�r�F)rorprqr9r:rTr��r�r�rnr.r�rUrVrtrr�r{r�r��AddMultiWriterFlagr�r�s   r#r�zCreateBeta.Args�s���� � �� �.�5�5�>�>�H�"�.�.�d�;�F�����,0��!�'+�(-���%�%�f�h�7�����*�*���4�1��"�"�6�*��0�0��8r%c
�4�|j|ddddddd��S)NT)r*rtrvrurqrwr9r+r�s  r#r-zCreateBeta.Runs0���9�9��� $��!%�!�,0�'+��	�	r%N�r�r�r�r�r�r�r-r!r%r#r�r��s��0��9��9�&
r%r�c�&�eZdZdZed��Zd�Zy)�CreateAlphar�c�|�|jd��jj}tjd��t
_t||ddddddd��	tj||�t|�tj|dd��tj|�tj|�y)NTr�r�)rorprqrrr9rsr:rTr�r�r�s   r#r�zCreateAlpha.Argss���� � �� �.�5�5�>�>�H�"�.�.�d�;�F�����,0��!�"�'+� �(,�
��%�%�f�h�7�����*�*���4�1��"�"�6�*��0�0��8r%c�8�|j|ddddddddd��
S)NT)	r*rtrurvrqrrrwr9rsr+r�s  r#r-zCreateAlpha.Run4s6���9�9��� $�!%��!�"�,0�'+� ���r%Nr�r!r%r#r�r�s��0��9��9�*r%r�c��|jd�s8|jd�r'|jd�stjdd��|j�Kt	j
|j|j|j|j|j�Stjj||jtj|j���}|D]Z}|j!�dk(s�|jd�r�)tjddj#|j%����|S)	z�Validate flags and parse disks references.

  Subclasses may override it to customize parsing.

  Args:
    args: The argument namespace
    compute_holder: base_classes.ComputeApiHolder instance

  Returns:
    List of compute.regionDisks resources.
  r r6r�rvz6--replica-zones is required for regional disk creation)r�r�z;--replica-zones is required for regional disk creation [{}])rHr�RequiredArgumentExceptionr r�ParseRegionDisksResourcesr��	DISK_NAMEr�r6rUrVr�rr�r�r�rXr�)r�r�r�r�s    r#r�r�Cs4���
�
�?�
+�
�
�
�8�
$���� 9�:�
�
.�
.��@�B�B�
���#��+�+�N�,D�,D�,0�N�N�D�<N�<N�,0�L�L�$�+�+�G�G����0�0�
�����.�.�~�/D�/D�E�1�G�)��h�����!6�6�� � �!:�;��0�0�
�
G�
N�
N����!�#�
$�$��
�r%c���|jd�}|jd�}||zr(|rdnd}|rdnd}tj||�d|�d���|r&|r#|j|_|j
|_yyy)z�Sets source machine image options on the disk.

  Args:
    args: The arguments namespace.
    disk: The disk message.

  Raises:
    exceptions.RequiredArgumentException: If only one of the source machine
      image arguments is specified.
  �source_machine_image�%source_machine_image_disk_device_namez'--source-machine-image-disk-device-namez--source-machine-imagez must be specified when z is specified.N)rHrr�r�� sourceMachineImageDiskDeviceNamer��sourceMachineImage)r�rT�has_source_machine_image�has_disk_device_name�missing_option�provided_options      r#rmrmrs���"�-�-�.D�E���)�)�-���� 4�4�$�	2�
%��$�	!�
6��
�
.�
.���
�2�?�2C�D�	���
 �$8��2�2�	�)�#�7�7�D��	%9�r%r�)FFFFFFF)Hr��
__future__rrrr�r�r��typingrr�googlecloudsdk.api_lib.computerr	r
rrr
rr�&googlecloudsdk.api_lib.compute.regionsr��googlecloudsdk.callioperrr�"googlecloudsdk.command_lib.computerrrr��(googlecloudsdk.command_lib.compute.disksrr.�4googlecloudsdk.command_lib.compute.resource_policiesrlrrZ�googlecloudsdk.command_lib.kmsrr��$googlecloudsdk.command_lib.util.apisr�$googlecloudsdk.command_lib.util.argsr�googlecloudsdk.corerr�
DETAILED_HELPr=rtr{r��strr�r�r�r�r��DefaultUniverseOnly�
ReleaseTracksr(�GA�CommandrU�BETAr��ALPHAr�r�rm�
detailed_helpr!r%r#�<module>r�s<��"�&��'��	�� �7�4�5�5�6�4�0�5�H�/�(�.�9�4�E�;�I�X�V�M�:�<�#�
�	1�	�.	�7!�
�N%*�4)�t).����#(��$)�mE�`	-�
#�+�%�c�]�+�
�c�]�+�K�
�
�
�K�.1�K�CK�C�=�K�
�c�]�K� �
�
�
� �.1� �
�c�]� �F�
�
�
��.1��
�c�]���������D�%�%�(�(�)�N1�T�\�\�N1�*��N1�b�������D�%�%�*�*�+�!��!�,��!�H�������D�%�%�+�+�,�%�*�%�-��%�P,�^$8�L%��r%