
    EM                     D   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Jr	  SSKJ
r  SSKJr  SSKJ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rSr " S S\	R>                  5      r  " S S\	R>                  5      r! " S S\RD                  5      r# " S S \	R>                  5      r$ " S! S"\	R>                  5      r%S# r&S$ r'S% r(S& r)S' r*S( r+S) r,S* r-S+ r.S, r/S- r0S. r1S`S0 jr2SaS2 jr3SaS3 jr4S4 r5S5 r6SaS6 jr7\Rp                  " S7\ S8S/S/S9S:\S;9r9\Rp                  " S7\#S8S/S/S9S<S:\S=9	r:\Rp                  " S>\	Rv                  S?S@SAS/S/SB\\Rx                  Rz                  SC9
r>\Rp                  " SDSE\	R~                  SFSGSHS/SI9r@\Rp                  " SJSK\!SLSMS/SN9rA\Rp                  " SOSP\	R                  SQ\SRSSS/\\ST9
rC\Rp                  " SUSV\	R                  SRSSSW\S/S/\Rx                  R                  \\SX9rE\Rp                  " SYSZS[S\S/S/\Rx                  Rz                  S]9rFS^ rGS_ rHg1)bz1Flags and helpers for the compute disks commands.    )absolute_import)division)unicode_literals)actions)
completers)flags)
propertiesa~        Source snapshot used to create the disks. It is safe to
      delete a snapshot after a disk has been created from the
      snapshot. In such cases, the disks will no longer reference
      the deleted snapshot. To get a list of snapshots in your
      current project, run `gcloud compute snapshots list`. A
      snapshot from an existing disk can be created using the
      `gcloud compute disks snapshot` command. This flag is mutually
      exclusive with *--image*.

      When using this option, the size of the disks must be at least
      as large as the snapshot size. Use *--size* to adjust the
      size of the disks.
zD      Name of the source instant snapshot used to create the disks.
zL      The project containing the instant snapshot used to create the disks.
a*        Source disk used to create the disk(s). It is safe to
      delete a source disk after a disk has been created from the
      source disk. To get a list of disks in your current project,
      run `gcloud compute disks list`. This flag is mutually
      exclusive with *--image* and *--source-snapshot*.

      When using this option, the size of the disks must be at least
      as large as the source disk size. Use *--size* to adjust the
      size of the disks.

      The source disk must be in the same zone/region as the disk to be created.
z~      Zone of the source disk. This argument is not required if the target disk
      is in the same zone as the source disk.
z      Region of the source disk. This argument is not required if the target
      disk is in the same region as the source disk.
zm      Primary disk for asynchronous replication. This flag is required when
      creating a secondary disk.
z      Zone of the primary disk for asynchronous replication. The primary and
      secondary disks must not be in the same region.
z      Region of the primary disk for asynchronous replication. The primary and
      secondary disks must not be in the same region.
zj      Secondary disk for asynchronous replication. This flag is required when
      starting replication.
z?      Zone of the secondary disk for asynchronous replication.
zA      Region of the secondary disk for asynchronous replication.
zB      Project of the secondary disk for asynchronous replication.
z@      Project of the primary disk for asynchronous replication.
ze    table(
      name,
      zone.basename(),
      sizeGb,
      type.basename(),
      status
    )z{
    table(
      name,
      location(),
      location_scope(),
      sizeGb,
      type.basename(),
      status
      )c                   (   ^  \ rS rSrU 4S jrSrU =r$ )SnapshotsCompleter   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.snapshotscompute snapshots list --uri)
collectionlist_command )superr   __init__selfkwargs	__class__s     5lib/googlecloudsdk/command_lib/compute/disks/flags.pyr   SnapshotsCompleter.__init__   s(    	
d, &3     r   __name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r   s   @r   r   r      s     r   r   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )SnapshotGroupsCompleter   c                 6   > [         [        U ]
  " SSSSS.UD6  g )Ncompute.snapshotGroupsz(alpha compute snapshot-groups list --urialphar   r   api_versionr   )r   r%   r   r   s     r   r    SnapshotGroupsCompleter.__init__   s+    	
!41 +? 	r   r   r   r#   s   @r   r%   r%      s     r   r%   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )SnapshotsCompleterAlpha   c                 F   > [         [        U ]
  " SS[        [        /0UD6  g )Nr   r   )r   r.   r   RegionSnapshotsCompleterGlobalSnapshotsCompleterr   s     r   r    SnapshotsCompleterAlpha.__init__   s)    	
!41 ,.FG
r   r   r   r#   s   @r   r.   r.      s     r   r.   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )r2      c                 6   > [         [        U ]
  " SSSSS.UD6  g )Nr   r   r)   r*   r   )r   r2   r   r   s     r   r   !GlobalSnapshotsCompleter.__init__   s+    	
"D2 &3 	r   r   r   r#   s   @r   r2   r2           r   r2   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )r1      c                 6   > [         [        U ]
  " SSSSS.UD6  g )Ncompute.regionSnapshotsz"compute regionSnapshots list --urir)   r*   r   )r   r1   r   r   s     r   r   !RegionSnapshotsCompleter.__init__   s+    	
"D2 ,9 	r   r   r   r#   s   @r   r1   r1      r8   r   r1   c           	      l    [         R                  " S[        R                  U SS[         R                  S9$ )Ndisk	DISK_NAMEcompute.disks)resource_name	completerpluralnamezonal_collectionzone_explanation)compute_flagsResourceArgumentcompute_completersDisksCompleterZONE_PROPERTY_EXPLANATIONrD   s    r   MakeDiskArgZonalrN      s5    		'	'"11&$>>
@ @r   c                     [         R                  " S[        R                  U SSS[         R                  [         R
                  S9$ )Nr?   r@   rA   compute.regionDisks)rB   rC   rD   rE   rF   regional_collectionrG   region_explanation)rH   rI   rJ   rK   rL   REGION_PROPERTY_EXPLANATIONrM   s    r   MakeDiskArgrT      sA    		'	'"11&/$>>&BB
D Dr   c                 $    U R                  SSSS9$ )Nz--multi-writer
store_truea>  
      Create the disk in multi-writer mode so that it can be attached
      with read-write access to two VMs. The multi-writer feature requires
      specialized filesystems, among other restrictions. For more information,
      see
      https://cloud.google.com/compute/docs/disks/sharing-disks-between-vms.
      actionhelpadd_argumentparsers    r   AddMultiWriterFlagr^      s%    			
 
 	
 	r   c                 $    U R                  SSSS9$ )Nz--confidential-computerV   z
      Creates the disk with confidential compute mode enabled. Encryption with a Cloud KMS key is required to enable this option.
      rW   rZ   r\   s    r    AddEnableConfidentialComputeFlagr`      s%    			
 
 
 r   c           	         U R                  SSS9  SnU R                  5       nUR                  S[        R                  [        R
                  " [        R                  R                  R                  5      UR                  S[        R                  5      S9  UR                  S[        R                  [        R
                  " [        R                  R                  R                  5      UR                  S	[        R                  5      S9  g
)z?Adds stop group async replication specific arguments to parser.DISK_CONSISTENCY_GROUP_POLICYzsURL of the disk consistency group resource policy. The resourcepolicy is always in the region of the primary disks.rY   z>{0} of the consistency group's primary or secondary disks. {1}--zoneZonerC   rX   rY   --regionRegionNr[   add_mutually_exclusive_grouprJ   ZonesCompleterr   StorePropertyr	   VALUEScomputezoneformatrH   rL   RegionsCompleterregionrS   r]   	help_textscope_parsers      r    AddStopGroupAsyncReplicationArgsrv      s    %B   P)446,"11"":#4#4#<#<#A#ABFM$K$KL	  N
 "33"":#4#4#<#<#C#CD


3
35	  6r   c           	         U R                  SSSS9  SnU R                  SS9nUR                  S[        R                  [        R
                  " [        R                  R                  R                  5      UR                  S[        R                  5      S	9  UR                  S
[        R                  [        R
                  " [        R                  R                  R                  5      UR                  S[        R                  5      S	9  g).Adds bulk create specific arguments to parser.!--source-consistency-group-policy
      URL of the source consistency group resource policy. The resource policy
      is always the same region as the source disks.
      TrY   requiredXTarget {0} of the created disks, which currently must be the same as the source {0}. {1}r|   rd   ro   rf   rg   rr   Nri   rs   s      r   AddBulkCreateArgsr      s    )
    m)44d4C,"11"":#4#4#<#<#A#ABFM$K$KL	  N
 "33"":#4#4#<#<#C#CDH)EEG	  Hr   c           	         U R                  SSSS9  SnU R                  SS9nUR                  S[        R                  [        R
                  " [        R                  R                  R                  5      UR                  S	[        R                  5      S
9  UR                  S[        R                  [        R
                  " [        R                  R                  R                  5      UR                  S[        R                  5      S
9  g)rx   ry   rz   Fr{   r}   Tr~   rd   ro   rf   rg   rr   Nri   rs   s      r   AddBulkCreateArgsAlphar     s    )
    m)44d4C,"11"":#4#4#<#<#A#ABFM$K$KL	  N
 "33"":#4#4#<#<#C#CDH)EEG	  Hr   c                 @    U R                  SUR                  5       SS9$ )Nz--provisioned-iopszeProvisioned IOPS of disk to create. Only for use with disks of type pd-extreme and hyperdisk-extreme.typerY   r[   
BoundedIntr]   arg_parserss     r   AddProvisionedIopsFlagr   1  s.    			!!#.	 
 
 r   c                 @    U R                  SUR                  5       SS9$ )Nz--provisioned-throughputzProvisioned throughput of disk to create. The throughput unit is  MB per sec.  Only for use with disks of type hyperdisk-throughput.r   r   r   s     r   AddProvisionedThroughputFlagr   <  s1    			 !!#O	 
 
Q Qr   c                     UR                   R                  nUR                  R                  /n[	        UR                  5        Vs/ s H  oDU;  d  M
  UPM     sn5      nU R                  SUSS9$ s  snf )Nz--architecturezSpecifies the architecture or processor type that this disk can support. For available processor types on Compute Engine, see https://cloud.google.com/compute/docs/cpu-platforms.choicesrY   )DiskArchitectureValueValuesEnumARCHITECTURE_UNSPECIFIEDrE   sortednamesr[   )r]   messagesarchitecture_enum_typeexcluded_enumsearchitecture_choicess         r   AddArchitectureFlagr   E  s~    #==DD*CCHHI.(..0L0Q^4Kq0LN			"E	 
 
  Ms   	A0A0c                     [        UR                  S5      (       a5  UR                  R                  nU R                  SUR	                  5       SS9$ g )NAccessModeValueValuesEnumz--access-modea'  Specifies how VMs attached to the disk can access the data on the disk. To grant read-only access to multiple VMs attached to the disk, set access-mode to READ_ONLY_MANY. To grant read-write access to only one VM attached to the disk, use READ_WRITE_SINGLE. READ_WRITE_SINGLE is used if omitted.r   )hasattrr   r   r[   r   )r]   r   access_mode_enum_types      r   AddAccessModeFlagr   U  sU    X]]788$MMCC%++-5	    9r   c                 &    U R                  SSSS9  g )Nz--location-hintTzM      Used by internal tools to control sub-zone location of the disk.
      )hiddenrY   rZ   r\   s    r   AddLocationHintArgr   f  s     
  r   Fc                     [         R                  " SS[        R                  SSS[        SU [         R
                  R                  [        [        S9$ )Nzasync secondary diskz--secondary-diskrA   rP   z,Secondary disk for asynchronous replication.FrB   rE   rC   rF   rQ   
short_helpdetailed_helprD   r|   scope_flags_usagezone_help_textregion_help_text)	rH   rI   rJ   rK   _ASYNC_SECONDARY_DISK_HELPScopeFlagsUsageGENERATE_DEDICATED_SCOPE_FLAGS&_ASYNC_SECONDARY_DISK_ZONE_EXPLANATION(_ASYNC_SECONDARY_DISK_REGION_EXPLANATIONr~   s    r   MakeSecondaryDiskArgr   o  sM    		'	'*"11&/?.%55%%;?
A Ar   Nc                 .    U R                  SU[        S9  g )Nz--secondary-disk-projectcategoryrY   )r[   )_ASYNC_SECONDARY_DISK_PROJECT_EXPLANATIONr]   r   s     r   AddSecondaryDiskProjectr     s     4  r   c                 .    U R                  SU[        S9  g )Nz--primary-disk-projectr   )r[   '_ASYNC_PRIMARY_DISK_PROJECT_EXPLANATIONr   s     r   AddPrimaryDiskProjectr     s    2  r   c                 f    U R                  5       nUR                  SSSS9  UR                  SSS9  g)	z,Adds keep old disk argument group to parser.z--keep-old-diskrV   z~If true, the old disk will be kept after the conversion. The old disk will be renamed to the original disk name with a suffix.rW   z--target-disk-namezSpecifies the name of the new disk, it can only be used with --keep-old-disk. For details on the naming convention for this resource, refer to: https://cloud.google.com/compute/docs/naming-resourcesrc   N)	add_groupr[   )r]   groups     r   AddKeepOldDiskArgsr     sK    



%	     
r   c                     U R                  5       nUR                  R                  R                  R                  /nUR                  SUSS9  g )Nz--add-guest-os-featureszSpecifies guest OS features to add to the disk. Refer to https://cloud.google.com/compute/docs/images/create-custom#guest-os-features for a list of available options.r   )r   GuestOsFeatureTypeValueValuesEnumGVNICrE   r[   )r]   r   r   guest_os_feature_choicess       r   AddGuestOsFeatureArgsr     sS    



%1177<< &.	  r   c                 .    U R                  SU[        S9  g )Nz!--source-instant-snapshot-projectr   )r[   ._DETAILED_SOURCE_INSTANT_SNAPSHOT_PROJECT_HELPr   s     r   AddSourceInstantSnapshotProjectr     s    )9  r   snapshotz--source-snapshotr   z)Source snapshot used to create the disks.)rB   rC   rE   rD   r|   global_collectionr   r   r<   )	rB   rC   rE   rD   r|   r   rQ   r   r   zsource instant snapshotz--source-instant-snapshotzcompute.instantSnapshotszcompute.regionInstantSnapshotsz=Name of the source instant snapshot used to create the disks.)
rB   rC   rE   rF   rQ   rD   r|   r   r   r   zsource instant snapshot groupz--source-instant-snapshot-groupz7Source instant snapshot group used to create the disks.zcompute.instantSnapshotGroupsz#compute.regionInstantSnapshotGroups)rB   rE   rC   r   rF   rQ   r|   zsource snapshot groupz--source-snapshot-groupz/Source snapshot group used to create the disks.r(   )rB   rE   rC   r   r   r|   zsource diskz--source-diskzlSource disk used to create the disks. Source disk must be in the same zone/region as the disk to be created.rA   rP   )
rB   rE   rC   r   r   rF   rQ   r|   r   r   zasync primary diskz--primary-diskziPrimary disk for asynchronous replication. This option creates a secondary disk for a given primary disk.r   zstorage poolz--storage-poolzCSpecifies the URI of the storage pool in which the disk is created.zcompute.storagePools)rB   rE   r   rF   rD   r|   r   c                 &    U R                  SSSS9  g )Nz--source-machine-imagez        Specifies the URI of the source machine image contiaining the disk to
        restore. Requires *--source-machine-image-disk-device-name* with the
        disk to restores device name.
      TrY   r   rZ   r\   s    r   AddSourceMachineImageNameArgr     s$     	

   r   c                 &    U R                  SSSS9  g )Nz'--source-machine-image-disk-device-namez        Specifies the name of the disk to be restored from the source machine
        image. Requires *--source-machine-image* with the URI of the source
        machine image.
      Tr   rZ   r\   s    r   &AddSourceMachineImageDiskDeviceNameArgr   -  s"    /

   r   )F)N)I__doc__
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   rJ   r   rH   googlecloudsdk.command_lib.utilgooglecloudsdk.corer	   _DETAILED_SOURCE_SNAPSHOT_HELP&_DETAILED_SOURCE_INSTANT_SNAPSHOT_HELPr   _SOURCE_DISK_DETAILED_HELP_SOURCE_DISK_ZONE_EXPLANATION_SOURCE_DISK_REGION_EXPLANATION_ASYNC_PRIMARY_DISK_HELP$_ASYNC_PRIMARY_DISK_ZONE_EXPLANATION&_ASYNC_PRIMARY_DISK_REGION_EXPLANATIONr   r   r   r   r   DEFAULT_LIST_FORMATMULTISCOPE_LIST_FORMATListCommandCompleterr   r%   MultiResourceCompleterr.   r2   r1   rN   rT   r^   r`   rv   r   r   r   r   r   r   r   r   r   r   r   r   r   rI   SOURCE_SNAPSHOT_ARGSOURCE_SNAPSHOT_ARG_ALPHAInstantSnapshotsCompleterr   USE_EXISTING_SCOPE_FLAGSSOURCE_INSTANT_SNAPSHOT_ARGInstantSnapshotGroupsCompleter!SOURCE_INSTANT_SNAPSHOT_GROUP_ARGSOURCE_SNAPSHOT_GROUP_ARGrK   SOURCE_DISK_ARGr   ASYNC_PRIMARY_DISK_ARGSTORAGE_POOL_ARGr   r   r   r   r   <module>r      s    8 &  ' + O E 6 *" * &2 . ! 
# 
 
( $
* &
 
* &, (- )+ '	  +@@ 0EE j?? 1FF 1FF @	D
60H6H6Q "A"2  $44 	):0	  *::%	)1:0
  ,<<+ ::	$/8N8#33LL
N  %2$B$B1	* ??H4=% ! *::)	"%@.   00	 //7,$-046 '77&	 //$-2*#33##7;=   !11 	+#33LLN 	r   