
                           S r SSKJr  SSKJr  SSKJr  SSKJr  SSKrSSKrSSKrSSK	J
r
Jr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK J!r!  SSK Jr"  SSK#Jr$  SSK#J%r&  SSK'J(r)  SSK*J+r+  SSK,J-r-  SSK.J/r/  SSK0r0SSSS.r1 S0S  jr2       S1S! jr3S" r4S# r5    S2S$ jr6        S3S% jr7      S4S& jr8      S4S' jr9\Rt                  \Rv                  " \Rx                  Rz                  5       " S( S)\R|                  5      5       5       r?\Rt                  \Rv                  " \Rx                  R                  5       " S* S+\?5      5       5       rA\Rt                  \Rv                  " \Rx                  R                  5       " S, S-\A5      5       5       rCS. rDS/ rE\1\?lF        g)5zCommand for creating disks.    )absolute_import)annotations)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                   U R                  5       nUR                  5       nS nUR                  SUS9  [        R                  " U5        UR                  SSS9  [        R
                  " U5        U(       a  [        R                  R                  XS9  O[        R                  R                  U5        U(       a  [        R                  " U 5        [        R                  R                  U5        [        R                  R                  XS9  [        R                  R                  XS9  [        R                  " U 5        [        R                  " U 5        g)z#Add mutually exclusive source args.c                 
    Sn U $ )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AddImageHelp!_SourceArgs.<locals>.AddImageHelpa   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?   X   s!    ((*$AAC,
 IL9!!"56  
 %%&9:#))55 6  ##//=$//7))55lC))&)K$$00 1  ##F+  (r'   c	                   [         R                  R                  USS9  UR                  SSS9  UR                  S[        R
                  " S/ SQS	9S
R                  [        R                  [        R                     [        R                  [        R                     [        R                  [        R                     [        R                  [        R                     5      S9  UR                  S[        R                  SS9  U(       a  UR                  SSS9  UR                  R!                  S5        UR                  S[        R"                  " 5       SSS9  [%        XU5        [&        R(                  " U[        5        [&        R*                  " X5        [&        R,                  " U[        5        [&        R.                  R                  U5        [&        R0                  " X5        U(       a,  [&        R2                  " U5        [&        R4                  " U5        U(       a%  UR                  S[        R"                  " 5       SSS9  [6        R8                  " U5        [:        R<                  " U5        U(       a  UR                  SSS/SSS9  U(       a  [>        R@                  " USS9  [B        RD                  " USS 5        g!)"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LICENSEzA list of URIs to license resources. The provided licenses will be added onto the created disks to indicate the licensing and billing policies.rL   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)   za source snapshot)resourcezadded todiskN)#Create	disks_argr2   r-   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?   r0   AddProvisionedIopsFlagAddArchitectureFlagAddProvisionedThroughputFlagSTORAGE_POOL_ARGAddAccessModeFlagAddSourceMachineImageNameArg&AddSourceMachineImageDiskDeviceNameArgr   AddCsekKeyArgsr   AddCreateLabelsFlagsr   AddEraseVssSignatureresource_flagsAddResourcePoliciesArgs)	messagesr:   #include_physical_block_size_supportvss_erase_enabledsupport_pd_interfacesupport_user_licensesr;   support_gmi_restorer<   s	            r$   _CommonArgsrv      sp    	vh?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6v>
  "5	  7 F#""6*(
!	   	v0CD((VDr'   c                N    U R                  S[        R                  " SSS9SSS9  g )N--replica-zones   )
min_length
max_lengthZONEzA 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`.rO   )r-   r   rc   )r:   s    r$   _AddReplicaZonesArgr}      s0    !:+	  -r'   c                    / nU R                   (       aU  U R                    HE  nUR                  R                  U5      nUR                  5       nXEl        UR	                  U5        MG     U$ )zParse GuestOS features.)guest_os_featuresGuestOsFeatureTypeValueValuesEnumrL   append)argsclient_messagesguest_os_feature_messagesfeaturegf_typeguest_os_features         r$   _ParseGuestOsFeaturesToMessagesr     sc     	))..BB7Kg(779%&&'78	 * 
#"r'   c                t    U (       d  g[         R                  " SU 5      nU(       a  UR                  S5      $ S$ )z7Gets the source instant-snapshot project from the path.Nzprojects/([^/]+)   )researchgroup)source_instant_snapshotmatchs     r$   (_GetSourceInstantSnapshotProjectFromPathr     s1     
!
))')@
A% Q*d*r'   c                    [         R                  R                  U UR                  US9nU(       a  UR	                  5       $ S$ )z1Resolves the instant snapshot reference to a URI.source_projectN)r0   r5   ResolveAsResource	resourcesSelfLink)r   compute_holderr   instant_snapshot_refs       r$   _GetInstantSnapshotReferencer   "  sL    
 --??


"
"' @   -A		&	&	(JdJr'   c                    [        U SS5      n[        U R                  5      nU(       a  X#:w  a  [        R                  " SS5      eU(       a  X#:X  a  [        XU5      $ U(       d
  [        XUS9$ g)z?Gets the URI when source_instant_snapshot_project is specified.source_instant_snapshot_projectNz!--source_instant_snapshot_projectzThe 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   0  s     "$(I4PD
""
 

: 
)
)+	6  

:'3  #'-B  
r'   c                x    U R                   (       a)  [        U SS5      (       d  [        XS5      $ [        X5      $ g)z+Determines the source instant snapshot URI.r   N)r   r   r   r   )r   r   s     r$   _GetSourceInstantSnapshotUrir   S  s?     
!!4:DAA)$EEA  
r'   c                      \ rS rSrSr\S 5       rS rS rS r	S r
S rS	 rS
 rS rS rS rS rS rS rS r\SS j5       rS r         SS jrSS jrSrg)rW   ia  'Create Compute Engine persistent disks.c                4   U R                  SS9R                  R                  n[        R                  " SS9[
        l        [        X!5        [        R                  " X5        [        U5        [        R                  " USSS9  [        R                  " U5        g )NTno_httppluralrV   region_fallthrough)_GetApiHolderclientrp   r0   MakeDiskArgrW   rX   rv   r   AddGuestOsFeaturesArgr}   kms_resource_argsAddKmsKeyResourceArg AddEnableConfidentialComputeFlagclsr:   rp   s      r$   ArgsCreate.Argsf  su       .55>>H"..d;F!%%f7**41008r'   c                @    UR                   (       a  UR                   $ / $ )zParse license.

Subclasses may override it to customize parsing.

Args:
  args: The argument namespace

Returns:
  List of licenses.
)licensesselfr   s     r$   ParseLicensesCreate.ParseLicensesq  s     }}]]Ir'   c                    [        X5      $ N)(_ValidateAndParseDiskRefsRegionalReplica)r   r   r   s      r$   ValidateAndParseDiskRefsCreate.ValidateAndParseDiskRefs  s    3DIIr'   c                @    UR                   =(       d    UR                  $ r   )imageimage_familyr   s     r$   GetFromImageCreate.GetFromImage  s    ::****r'   c                    UR                   $ r   )r   r   s     r$   GetFromSourceInstantSnapshot#Create.GetFromSourceInstantSnapshot  s    '''r'   c                ,    U(       a  [        USS 5      $ g )Nsource_machine_image)r   )r   r   ru   s      r$   GetFromSourceMachineImage Create.GetFromSourceMachineImage  s    T1488r'   c                   [         R                  " UR                  5      nU(       aK  UR                  [        R
                  ;   a,  US:  a&  [        R                  " SSR                  U5      5      eOUR                  (       dD  U(       d=  UR                  (       d,  U R                  U5      (       d  U R                  X5      (       a  OoUR                  [        R                  ;   a  [        R                  UR                     nO3UR                  (       a  O![        R                  [        R                     n[         R                  " XAR                  5        U$ )N
   rB   z=Value must be greater than or equal to 10 GB; reveived {0} GB)r   	BytesToGbsizerL   r
   LEGACY_DISK_TYPE_LISTr   InvalidArgumentExceptionrZ   source_snapshotsource_diskr   r   r[   r\   WarnIfDiskSizeIsTooSmall)r   r   
from_imageru   size_gbs        r$   GetDiskSizeGbCreate.GetDiskSizeGb  s    oodii(G 
i55	5'B,11KVG_
 	
 ,,T22))$DD 	i88	822499=g	
 22

)
)+g	""7II6Nr'   c                
   0 n[         R                  " UR                  UR                  5      nU H  nU(       a  UR                  U;  a  UR                  UR                  UR                  UR                  UR                  SUR                  SS9u  p[        R                  " 5       XWR                  '   XUR                     l        M  M  [        R                  " 5       XWR                  '   S XWR                     l        M     U$ )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$   GetProjectToSourceImageDict"Create.GetProjectToSourceImageDict  s      ..~/D/D/=/G/GIN 	#:: . > >#++JJ,, ..$)!%!8!8)- !? !/

 7?6H6H6J
!"2"2
3:J("2"2
3
7 ; 5=4F4F4H 0 018< 0 015   #"r'   c                    [         R                  " U5      nUR                  S U 5       5        [        R                  " U5      nUR                  S U 5       5        g )Nc              3  P   #    U  H  oR                  5       S :X  d  M  Uv   M     g7f)compute.disksN
Collection.0refs     r$   	<genexpr>BCreate.WarnAboutScopeDeprecationsAndMaintenance.<locals>.<genexpr>  s     I	^^%5%H	   &	&c              3  P   #    U  H  oR                  5       S :X  d  M  Uv   M     g7f)compute.regionDisksNr   r   s     r$   r   r     s     O	^^%59N%N	r   )r   ZoneResourceFetcherWarnForZonalCreationregion_utilsRegionResourceFetcherWarnForRegionalCreation)r   r   r   zone_resource_fetcherregion_resource_fetchers        r$   (WarnAboutScopeDeprecationsAndMaintenance/Create.WarnAboutScopeDeprecationsAndMaintenance  sT    &::6B..I	IK +@@H33O	OQr'   c                V   U(       d+  [         R                  R                  UUR                  5      nO`[         R                  R                  UUR                  [
        R                  " UR                  5      [        R                  R                  S9nU(       a  UR                  5       $ g )N)scope_listerdefault_scope)r0   r3   r   r   r1   r   GetDefaultScopeListerr   compute_scope	ScopeEnumGLOBALr   )r   r   r   r;   snapshot_refs        r$   GetSnapshotUriCreate.GetSnapshotUri  s     * 44FF


"
"l
 !::LL


"
"22>3H3HI%//66	 M l ""$$r'   c                $   S nUR                   (       a  UR                  (       a*  [        R                  R	                  XR
                  5      nOUR                  5       S:X  aB  [        R                  R	                  UUR
                  [        R                  R                  S9nOUUR                  5       S:X  aA  [        R                  R	                  UUR
                  [        R                  R                  S9nU(       a  UR                  5       $ g )Nr   r  r   )r   source_disk_zoner0   r6   r   r   r   r
  r  r|   REGIONr   )r   r   r   r   source_disk_refs        r$   GetSourceDiskUriCreate.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                    S nUR                   (       aL  [        USS 5      n[        R                  R	                  XR
                  US9nU(       a  UR                  5       $ g )Nprimary_disk_projectr   )primary_diskr   r0   r7   r   r   r   )r   r   r   primary_disk_refr  s        r$   GetAsyncPrimaryDiskUriCreate.GetAsyncPrimaryDiskUri  sa    $T+A4H$;;MM
((9M N  
((**r'   c                    UR                   (       aX  [        R                  R                  UUR                  [
        R                  R                  S9nU(       a  UR                  5       $ g )Nr  )	storage_poolr0   rg   r   r   r
  r  r|   r   )r   r   r   storage_pool_refs       r$   GetStoragePoolUriCreate.GetStoragePoolUri
  sZ    $55GG


"
"%//44 H 
 
((**r'   c                R   S n[        USS 5      nU(       a  UR                  R                  R                  [	        [
        R                  " UR                  5      5       VVs/ s H2  u  pVUR                  R                  R                  R                  XVS9PM4     snnS9nU$ s  snnf )Nlabels)keyvalue)additionalProperties)	r   rp   DiskLabelsValuesortedsix	iteritemsr#  AdditionalProperty)r   r   r   r#  args_labelsr$  r%  s          r$   	GetLabelsCreate.GetLabels  s    F$$/K##// #3==#=>F ?jc //


*
*
=
= > $>F/ 	f
 MFs   "9B#
c                    / nUR                    HI  nUR                  R                  USSUR                  0S9nUR	                  UR                  5       5        MK     U$ )Nzcompute.zonesr   )
collectionparams)replica_zonesr   Parser   r   r   )r   r   r   r   resultzonezone_refs          r$   GetReplicaZonesCreate.GetReplicaZones   sd    F""))//
$X--. 0 0h mmH%%'( # Mr'   c                L    [         R                  " U R                  5       U5      $ r   )r	   ComputeApiHolderReleaseTrack)r   r   s     r$   r   Create._GetApiHolder*  s    (()9)9);WEEr'   c                "    U R                  USS9$ )NT)supports_kms_keys_Runr   s     r$   Run
Create.Run.  s    99TT922r'   c                l   U R                  5       nUR                  nUR                  S5      =(       dA    UR                  S5      =(       d)    UR                  S5      =(       d    UR                  S5      (       + U l        U R                  =(       a    UR                  S5      (       + U l        U R	                  X5      nU R                  U5      nU R                  XU
5      nU R                  X5        U R                  XX5      nU R                  XU	5      nU R                  X5      n[        R                  R                  US5      nU HI  nUU   R                  n[        R                  " UUR                   UU/UR"                  5      UU   l        MK     ['        XR(                  5      n/ nU GHp  n[*        R,                  " UR.                  UU5      n0 nU(       a  UR1                  UUR2                  5      n[        R4                  " UUR"                  5      nUUS'   UUR6                     R$                  S   US	'   UUR6                     R$                  S
   US'   U(       a  UUS'   U(       a4  [8        R:                  " XR(                  UR=                  SS 5      5      US'   U(       aS  UR>                  (       aB  [@        RB                  " UR>                  UR(                  RD                  RF                  5      US'   URH                  (       a5  UR(                  RK                  5       nU RM                  X5      Ul'        UUS'   U(       a,  UR                  S5      (       a  [Q        URR                  5      nOS n[U        USS 5      nU(       a  URW                  5       S:X  a  URX                  n O [Z        R\                  " UR^                  5      n / n!U HM  n"[`        Rb                  " UR                   U"UR6                  U S9n#U!Re                  U#Rg                  5       5        MO     U!US'   UR(                  RD                  " S)URi                  5       URj                  UUUUR6                     R                  UUS.UD6n$U Rm                  UUU5      U$l7        [q        X5      U$l9        U(       a;  URW                  5       S;   a'  UR                  S5      (       a  URt                  U$l;        U(       a'  UR                  S5      (       a  URx                  U$l=        U(       a  UU$l>        U(       a'  UR                  S5      (       a  UR~                  U$l@        U R                  U5      U$lB        UR                  S5      (       aK  U(       a-  [*        R                  " U5      (       a  UR                  U$lE        O[        R                  " SS5      eUR                  S5      (       aK  U(       a-  [*        R                  " U5      (       a  UR                  U$lJ        O[        R                  " SS5      eUR                  S5      (       a   U$R                  UR                  5      U$lL        UR                  S 5      (       a   U$R                  UR                  5      U$lO        U(       a'  UR                  S!5      (       a  UR                  U$lQ        UR                  S"5      (       a  UR                  U$lS        UR                  S#5      (       a  U R                  X5      U$lU        U
(       a  [        UU$5        URW                  5       S$:X  aI  UR(                  R                  U$UR6                  UR^                  S%9n%UR"                  R                  S&U%4n%OURW                  5       S:X  au  UR                  S'5      (       a  U R                  XU5      U$lZ        UR(                  R                  U$UR6                  URX                  S(9n%UR"                  R                  S&U%4n%URe                  W%5        GMs     UR                  U5      $ )*Nr   r   r   r   r   TdiskEncryptionKeyr   sourceImageEncryptionKeyr   sourceSnapshotEncryptionKeyr#  	interfaceasyncPrimaryDiskphysical_block_sizeresource_policiesr   )r   regionresourcePolicies)namedescriptionsizeGbsourceSnapshotsourceImagerL   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   )rV   r   r6  Insertr3  )rV   r   rL  r"   )^r   r   IsSpecifiedshow_unformated_messager   r   r   r  r   r  r.  r   CsekKeyStoreFromArgsr   MaybeLookupKeyMessagesByUrir   apitools_clientkeysr   rp   r   GetDiskTypeUrirL   	LookupKeyrequire_csek_key_createMaybeToMessager   r   MaybeGetKmsKeygetrH  r   ChoiceToEnumr'  InterfaceValueValuesEnumr  DiskAsyncReplicationr  rV   intrJ  r   r   rL  r   ZoneNameToRegionNamer6  resource_utilParseResourcePolicyr   r   NamerO  r  
sourceDiskr   sourceInstantSnapshotrT  multiWriterrU  enableConfidentialComputeguestOsFeaturesrV  eraseWindowsVssSignaturer   r   IsProvisioningTypeIopsrW  provisionedIopsr   r   IsProvisioningTypeThroughputrX  provisionedThroughputArchitectureValueValuesEnumrY  AccessModeValueValuesEnumrZ  
accessModer[  userLicensesr\  locationHintr   storagePool_SetSourceMachineImageOptionsComputeDisksInsertRequestdisksr8  replicaZonesComputeRegionDisksInsertRequestregionDisksMakeRequests)&r   r   r?  supports_physical_blocksupport_multiwriter_disksupport_vss_erasers   rt   #support_enable_confidential_computer;   ru   r   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_bytesrK  disk_regionparsed_resource_policiespolicyresource_policy_refrV   requests&                                         r$   rA  Create._Run1  sV    '')N""F 	! 	+N+	+-.	+ M*	$D  $(#?#? $23ED  --dCI""4(J  3FGG11)D">> &&<L ^^D)F''00t<I*09==

0
011.0F0FH g&+ + !@oo! H**499hOhf	$..x/3/K/KM#-#<#<f44$6 &>"##H$4$45::1= 	)* $H$4$45::1= 	,-	!x	&/&>&>//6::.A4#H'J"# 
$..'44NNFOO00IIK{ 
		;;= 77M%1!"	 T%5%56K%L%L$'(@(@$A!$(!!$(;TB	 $99 +228==A+#% 'F - A A&&&& 	!"

 #
)
)*=*F*F*H
I ( &>!"__!! }}&&%-h.>.>?CC!: d --dHnMdo#?
$ d  #



#K
K


>
*
*,,	,1A1A
 2 2 *.)B)B&	"8	t//0MNN(,(H(H%((.dm			,	-	-
99(CC!%!6!6$
33"KM M 
		
"
$ 
$
??II'+'B'B$
$33( 
 
		.	)	) <<T=N=NO			-	(	(889I9IJ	4#3#3O#D#D ..			/	*	* ..			.	)	)11$G	%dD1				/	1//;;x//hmm < E ))//7C $99O,,"22H$
 //AAx// B I ))55xIoogS V x((r'   c                    SnU R                   (       a4  [        R                  R                  [        R
                  " U5      5        g g )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
        )r_  r   statusPrinttextwrapdedent)r   resources_were_displayedmessages      r$   EpilogCreate.Epilog  s4    G ##	jjxw/0 $r'   )r_  NF)	FFFFFFTFF)T)__name__
__module____qualname____firstlineno____doc__classmethodr   r   r   r   r   r   r   r   r  r  r  r  r   r.  r8  r   rB  rA  r  __static_attributes__r"   r'   r$   rW   rW   a  s     09 9J+(
$L#2Q&*			 F F3 #$ !*.%*)B	1r'   rW   c                  .    \ rS rSrSr\S 5       rS rSrg)
CreateBetai  r   c           
     h   U R                  SS9R                  R                  n[        R                  " SS9[
        l        [        UUSSSSSS9  [        R                  " X5        [        U5        [        R                  " USSS9  [        R                  " U5        [        R                  " U5        g )NTr   r   F)rq   rr   rs   r;   r<   rV   r   r   r   rp   r0   r   rW   rX   rv   r   r   r}   r   r   AddMultiWriterFlagr   r   s      r$   r   CreateBeta.Args  s       .55>>H"..d;F,0!'+(- %%f7**41""6*008r'   c                .    U R                  USSSSSSSS9$ )NT)r?  r  r  r  rs   r  r;   r@  r   s     r$   rB  CreateBeta.Run  s0    99 $!%!,0'+  	 	r'   r"   N	r  r  r  r  r  r  r   rB  r  r"   r'   r$   r  r    s     09 9&
r'   r  c                  .    \ rS rSrSr\S 5       rS rSrg)CreateAlphai$  r   c                l   U R                  SS9R                  R                  n[        R                  " SS9[
        l        [        UUSSSSSSSS9	  [        R                  " X5        [        U5        [        R                  " USSS9  [        R                  " U5        [        R                  " U5        g )NTr   r   )rq   rr   rs   rt   r;   ru   r<   rV   r   r  r   s      r$   r   CreateAlpha.Args)  s       .55>>H"..d;F,0!"'+ (,
 %%f7**41""6*008r'   c                2    U R                  USSSSSSSSSS9
$ )NT)	r?  r  r  r  rs   rt   r  r;   ru   r@  r   s     r$   rB  CreateAlpha.Run?  s6    99 $!%!",0'+    r'   r"   Nr  r"   r'   r$   r  r  $  s     09 9*r'   r  c                   U R                  S5      (       dC  U R                  S5      (       a-  U R                  S5      (       d  [        R                  " SS5      eU R                  bL  [        R
                  " UR                  U R                  U R                  U R                  U R                  5      $ [        R                  R                  U UR                  [        R                  " UR                  5      S9nU Hc  nUR!                  5       S:X  d  M  U R                  S5      (       a  M1  [        R                  " SSR#                  UR%                  5       5      5      e   U$ )	zValidate 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.
r3  rL  r   rx   z6--replica-zones is required for regional disk creation)r  r   z;--replica-zones is required for regional disk creation [{}])r^  r   RequiredArgumentExceptionr3  r   ParseRegionDisksResourcesr   	DISK_NAMEr   rL  rW   rX   r   r   r	  r   r   rZ   r   )r   r   r   r   s       r$   r   r   N  s@    

?
+
+


8
$
$ 9::

.
.@B B 
#++N,D,D,0NND<N<N,0LL$++G G 00
..~/D/DE 1 G) h!66  !:;;00

G
N
N!#$ $  
r'   c                $   U R                  S5      nU R                  S5      nX#-  (       a3  U(       a  SOSnU(       a  SOSn[        R                  " UU SU S35      eU(       a+  U(       a#  U R                  Ul        U R
                  Ul        ggg)zSets 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.
r   %source_machine_image_disk_device_namez'--source-machine-image-disk-device-namez--source-machine-imagez must be specified when z is specified.N)r^  r   r  r   sourceMachineImageDiskDeviceNamer   sourceMachineImage)r   rV   has_source_machine_imagehas_disk_device_namemissing_optionprovided_options         r$   r  r  }  s     "--.DE))- 4 $ 	2%  $ 	!6 
 
.
.
2?2C D 	 
  $822 	) #77D	 %9r'   r  )FFFFFFF)r   Optional[str]returnr  )r   argparse.Namespacer   r   r   r  r  r  )r   r  r   r   r  r  )Gr  
__future__r   r   r   r   r   r   r  typingr   r   googlecloudsdk.api_lib.computer	   r
   r   r   r   r   r   r   &googlecloudsdk.api_lib.compute.regionsr   googlecloudsdk.callioper   r   r   "googlecloudsdk.command_lib.computer   r   r   r
  (googlecloudsdk.command_lib.compute.disksr   r0   4googlecloudsdk.command_lib.compute.resource_policiesrn   r   rp  googlecloudsdk.command_lib.kmsr   r   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r*  DETAILED_HELPr?   rv   r}   r   r   r   r   r   DefaultUniverseOnlyReleaseTracksr<  GACommandrW   BETAr  ALPHAr  r   r  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 ).#($)mE`	-
#+*++K
K.1KCPKK 
 .1  F
.1 D%%(()X1T\\ X1 * X1v D%%**+! ! , !H D%%++,%* % - %P,^$8L % r'   