
    "                        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S
KJr  SS
KJr  SS	KJr  SrSrSr\R,                  rSr " S S\R2                  5      r " S S\R6                  5      rS1S jrS rS r\R@                  " SS\SSS\S9r!\R@                  " SS\RD                  SS\\SS 9r#\R@                  " S!S"\SS#SS$9r$\R@                  " S%S&\RJ                  SS'S(\S)9r&S2S* jr'S+ r(S, r)S- r*S. r+S/ r,g0)3z;Flags and helpers for the compute backend-buckets commands.    )absolute_import)division)unicode_literals)actions)arg_parsers)base)
exceptions)
completers)flagsz        A source disk to create the image from. The value for this option can be
        the name of a disk with the zone specified via ``--source-disk-zone''
        flag.
z        A source snapshot to create the image from. The value for this option
        can be the name of a snapshot within the same project as the destination
        image.
a         Specifies a Compute Engine image as a replacement for the image
       being phased out. Users of the deprecated image will be
       advised to switch to this replacement. For example, *--replacement
       example-image* or *--replacement
       projects/google/global/images/example-image*.

       This flag value is purely informational and is not validated in any way.
       z    table(
      name,
      selfLink.map().scope(projects).segment(0):label=PROJECT,
      family,
      deprecated.state:label=DEPRECATED,
      status
    )c                   (   ^  \ rS rSrU 4S jrSrU =r$ )ImagesCompleter?   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.imageszcompute images list --uri)
collectionlist_command )superr   __init__selfkwargs	__class__s     6lib/googlecloudsdk/command_lib/compute/images/flags.pyr   ImagesCompleter.__init__A   s'    	/4) #0     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$ )SearchImagesCompleterH   c                 2   > [         [        U ]
  " SSS0UD6  g )Nr   r   r   )r   r&   r   r   s     r   r   SearchImagesCompleter.__init__J   s#    	
/ #
r   r   r   r$   s   @r   r&   r&   H   s     r   r&   Fc           	      <    [         R                  " SU[        U USS9$ )N
disk imager   )resource_namename	completerpluralrequiredglobal_collection)compute_flagsResourceArgumentr   )r/   r0   r-   s      r   MakeDiskImageArgr4   P   s'    		'	' (
* *r   c            
      Z    [         R                  " S[        R                  " SSSSS9SSS	9$ )
Nz--force-createzforce-createz5Flag force-create is deprecated. Use --force instead.z2Flag force-create is removed. Use --force instead.
store_true)	flag_namewarnerroractionFa            DEPRECATED, use --force instead.
          By default, image creation fails when it is created from a disk that
          is attached to a running instance. When this flag is used, image
          creation from disk will proceed even if the disk is in use.
          r:   defaulthelp)r   Argumentcalliope_actionsDeprecationActionr   r   r   MakeForceCreateArgrA   Z   s:    	//"FD	
 
 r   c                  0    [         R                  " SSSSS9$ )Nz--forcer6   Fz          By default, image creation fails when it is created from a disk that
          is attached to a running instance. When this flag is used, image
          creation from disk will proceed even if the disk is in use.
          r;   )r   r>   r   r   r   MakeForceArgrC   k   s!    		
 r   r+   z--replacementr   z2Specifies a Compute Engine image as a replacement.)r,   r-   r.   r1   r0   
short_helpdetailed_helpzsource diskz--source-diskzcompute.disksz*The deprecation state to set on the image.)r,   r-   r.   zonal_collectionrD   rE   zone_explanationr0   zsource image--source-imagez6An existing Compute Engine image from which to import.)r,   r-   r.   r1   rD   r0   snapshotz--source-snapshotzcompute.snapshotsz*A source snapshot used to create an image.)r,   r-   r.   r0   r1   rD   rE   c                     U R                  SSS9  U R                  SSS9  U(       a%  U R                  S[        R                  " 5       SSS	9  U R                  S
[        R                  " 5       SS9  g)zAdd common image creation args.z--descriptionz=An optional, textual description for the image being created.r=   z--familyzThe family of the image. When creating an instance or disk, specifying a family will cause the latest non-deprecated image in the family to be used.z--user-licensesLICENSEzdURI for the license resource. For multiple licenses, you can provide a comma-separated list of URIs.)typemetavarr=   z
--licensesz2Comma-separated list of URIs to license resources.)rM   r=   N)add_argumentr   ArgList)parsersupport_user_licensess     r   AddCommonArgsrS      s    K  N 	(   
  "r   	 ?  Ar   c                 J    UR                  SSS9  [        R                  XS9  g)z=Add common args for specifying the source for image creation.z--source-uria         The full Cloud Storage URI where the disk image is stored.
      This file must be a gzip-compressed tarball whose name ends in
      ``.tar.gz''.
      For more information about Cloud Storage URIs,
      see https://cloud.google.com/storage/docs/request-endpoints#json-api.
      rK   mutex_groupN)rO   SOURCE_DISK_ARGAddArgumentrQ   sources_groups     r   AddCommonSourcesArgsr[      s0    
   f@r   c                 d    UR                  SSS9  UR                  SSS9  U R                  SSS9  g)	z"Add args to support image cloning.rH   z      The name of an image to clone. May be used with
      ``--source-image-project'' to clone an image in a different
      project.
      rK   z--source-image-familyz      The family of the source image. This will cause the latest non-
      deprecated image in the family to be used as the source image.
      May be used with ``--source-image-project'' to refer to an image
      family in a different project.
      z--source-image-projectz      The project name of the source image. Must also specify either
      ``--source-image'' or ``--source-image-family'' when using
      this flag.
      NrO   rY   s     r   AddCloningImagesArgsr^      sW    
   
   	
  r   c                 *    [         R                  XS9  g)z1Add args to support creating image from snapshot.rU   N)SOURCE_SNAPSHOT_ARGrX   rY   s     r    AddCreatingImageFromSnapshotArgsra      s    !!&!Dr   c           
      ,   SnU Vs/ s H  n[        XR                  SS5      5      PM      nn[        S U 5       5      nU Vs/ s H  nSU-   PM
     nnUS:  a  [        R                  " U6 eUS:  a  [        R
                  " UU5      egs  snf s  snf )zGValidate that there is one, and only one, source for creating an image.z+Please specify a source for image creation.-_c              3   8   #    U  H  n[        U5      v   M     g 7f)N)bool).0as     r   	<genexpr>%ValidateSourceArgs.<locals>.<genexpr>   s     :/Qa/s   z--   N)getattrreplacesumr	   ConflictingArgumentsExceptionMinimumArgumentException)argssourcessources_error_messagessource_arg_listsource_arg_countsource_arg_namess          r   ValidateSourceArgsrx      s    G BIIAWT99S##67/I:/::(/01dQh0

2
24D
EE

-
-.>.CE E  J 1s   %BBc                 $    U R                  SSS9  g )Nz--source-disk-projectzm        Project name of the source disk. Must also specify
        --source-disk when using this flag.
      rK   r]   )rQ   s    r   AddSourceDiskProjectFlagrz      s    
  r   N)FT
image_name)F)-__doc__
__future__r   r   r   googlecloudsdk.callioper   r?   r   r   r	   "googlecloudsdk.command_lib.computer
   compute_completersr   r2   (googlecloudsdk.command_lib.compute.disksdisks_flagsgooglecloudsdk.command_lib.util_SOURCE_DISK_DETAILED_HELP_SOURCE_SNAPSHOT_DETAILED_HELP_REPLACEMENT_DISK_DETAILED_HELPZONE_PROPERTY_EXPLANATION_SOURCE_DISK_ZONE_EXPLANATIONLIST_FORMATListCommandCompleterr   ResourceSearchCompleterr&   r4   rA   rC   r3   REPLACEMENT_DISK_IMAGE_ARGDisksCompleterrW   SOURCE_IMAGE_ARGSnapshotsCompleterr`   rS   r[   r^   ra   rx   rz   r   r   r   <module>r      sZ    B &  ' ? / ( . O E I 6 
" 
#  !. G G 	(== J>> *"	 +;;	&C13   00	 //$;,2 !11 	&G  $44	,,);0 A8A8E
E&r   