
                            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\	R                   " \	R"                  R$                  5       " S
 S\	R&                  5      5       r\	R                   " \	R"                  R*                  5       " S S\5      5       r\	R                   " \	R"                  R.                  5       " S S\5      5       rSSSS.\l        g)z Delete instant snapshot command.    )absolute_import)division)unicode_literals)base_classes)utils)base)flagsc                 z    [         R                  " SS9[        l        [        R                  R	                  U SS9  g)z?A helper function to build args based on different API version.T)pluraldelete)operation_typeN)	ips_flagsMakeInstantSnapshotArgDeleteips_argAddArgument)parsers    /lib/surface/compute/instant_snapshots/delete.py_CommonArgsr      s+    334@&...VH=    c                   @    \ rS rSrSrS rS r\S 5       rS r	S r
Srg	)
r   "   z(Delete Compute Engine instant snapshots.c                     [        S U 5       5      n[        S U 5       5      nU(       a  U(       d  gU(       a  U(       d  gg)z!Gets common scope for references.c              3   :   #    U  H  n[        US 5      v   M     g7f)zoneNhasattr.0refs     r   	<genexpr>4Delete._GetCommonScopeNameForRefs.<locals>.<genexpr>(   s     84C73''4   c              3   :   #    U  H  n[        US 5      v   M     g7f)regionNr   r   s     r   r!   r"   )   s     <tWS(++tr#   r   r%   N)any)selfrefshas_zone
has_regions       r   _GetCommonScopeNameForRefs!Delete._GetCommonScopeNameForRefs&   s5    8488H<t<<J
	Hr   c                    UR                   n/ nU H  nUR                  5       S:X  a@  UR                  nUR                  UR	                  5       UR
                  UR                  S9nO|UR                  5       S:X  a@  UR                  nUR                  UR	                  5       UR
                  UR                  S9nO([        SR                  UR                  5       5      5      eUR                  USU45        M     U$ )z8Returns a list of delete messages for instant snapshots.zcompute.instantSnapshots)instantSnapshotprojectr   zcompute.regionInstantSnapshots)r.   r/   r%   zUnknown reference type {0}r   )MESSAGES_MODULE
CollectioninstantSnapshots$ComputeInstantSnapshotsDeleteRequestNamer/   r   regionInstantSnapshots*ComputeRegionInstantSnapshotsDeleteRequestr%   
ValueErrorformatappend)r'   clientips_refsmessagesrequestsips_refservicerequests           r   _CreateDeleteRequestsDelete._CreateDeleteRequests2   s     %%HH				!;	;))??#LLNOO @  #CC//EE#LLNOO>> F #
 5<< " # 	# oow'23# $ Or   c                     [        U5        g Nr   clsr   s     r   ArgsDelete.ArgsK   
    r   c                    [         R                  " U R                  5       5      n[        R                  R                  UUR                  [        R                  " UR                  5      S9nU R                  U5      n[        R                  " X4S S9  [        U R                  UR                  R                  U5      5      nUR                  R!                  U5      $ )N)scope_lister)
scope_nameprompt_title)r   ComputeApiHolderReleaseTrackr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr:   r+   r   PromptForDeletionlistrA   apitools_clientMakeRequests)r'   argsholderr;   rM   r=   s         r   _RunDelete._RunO   s    **4+<+<+>?F~~//"88G 0 H 00:J	H$O""6==#@#@(KMH ==%%h//r   c                 $    U R                  U5      $ rD   r[   r'   rY   s     r   Run
Delete.Runa       99T?r    N)__name__
__module____qualname____firstlineno____doc__r+   rA   classmethodrH   r[   r`   __static_attributes__rc   r   r   r   r   "   s-    0
2  0$r   r   c                   .    \ rS rSrSr\S 5       rS rSrg)
DeleteBetae   z0Delete Compute Engine instant snapshots in beta.c                     [        U5        g rD   rE   rF   s     r   rH   DeleteBeta.Argsi   rJ   r   c                 $    U R                  U5      $ rD   r^   r_   s     r   r`   DeleteBeta.Runm   rb   r   rc   N	rd   re   rf   rg   rh   ri   rH   r`   rj   rc   r   r   rl   rl   e   s    8 r   rl   c                   .    \ rS rSrSr\S 5       rS rSrg)DeleteAlphaq   z1Delete Compute Engine instant snapshots in alpha.c                     [        U5        g rD   rE   rF   s     r   rH   DeleteAlpha.Argsu   rJ   r   c                 $    U R                  U5      $ rD   r^   r_   s     r   r`   DeleteAlpha.Runy   rb   r   rc   Nrr   rc   r   r   rt   rt   q   s    9 r   rt   z(Delete a Compute Engine instant snapshotz        *{command}* deletes a Compute Engine instant snapshot. A disk can be
        deleted only if it is not attached to any virtual machine instances.
        a          To delete Compute Engine instant snapshots with the names 'instant-snapshot-1'
        and 'instant-snapshot-2', run:

          $ {command} instant-snapshot-1 instant-snapshot-2

        To list all instant snapshots that were created before a specific date, use
        the --filter flag with the `{parent_command} list` command.

          $ {parent_command} list --filter="creationTimestamp<'2017-01-01'"

        For more information on how to use --filter with the list command,
        run $ gcloud topic filters.
        )briefDESCRIPTIONEXAMPLESN)rh   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   rS   4googlecloudsdk.command_lib.compute.instant_snapshotsr   r   ReleaseTracksrP   GADeleteCommandr   BETArl   ALPHArt   detailed_helprc   r   r   <module>r      s    ' &  ' 7 0 ( E S> D%%(()?T ? *?D D%%**+  , D%%++,&  - 8 r   