
    S
                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ  G d
 dej"                        Zy)z'Cloud Pub/Sub snapshots delete command.    )absolute_import)division)unicode_literals)
exceptions)	snapshots)base)util)logc                   &    e Zd ZdZed        Zd Zy)Deletez,Deletes one or more Cloud Pub/Sub snapshots.c                 ,    | j                  ddd       y)z!Registers flags for this command.snapshot+z%One or more snapshot names to delete.)nargshelpN)add_argument)parsers    &lib/surface/pubsub/snapshots/delete.pyArgszDelete.Args!   s      #$K  M    c           	   #     K   t        j                         }g }|j                  D ]  }t        j                  |      }	 |j                  |       t        j"                  |j$                  j'                  |j                                     }t        j                  |j                         d       |  |rt        j(                  |d      y# t        j                  $ r~}t        j                  |      }t        j                  |j                         dt        j                  |j                  j                               |j!                  |       Y d}~7d}~ww xY ww)a  This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Yields:
      A serialized object (dict) describing the results of the operation.
      This description fits the Resource described in the ResourceRegistry under
      'pubsub.projects.snapshots'.

    Raises:
      util.RequestFailedError: if any of the requests to the API failed.
    r   )kindfailedN)name)r   delete)r   SnapshotsClientr   r	   ParseSnapshotr   api_ex	HttpErrorr   HttpExceptionr
   DeletedResourceRelativeNameCreateFailureErrorMessagepayloadstatus_messageappendSnapshotDisplayDictmessagesSnapshotRequestsFailedError)	selfargsclientr   snapshot_namesnapshot_referrorexcresults	            r   Runz
Delete.Run(   s#     &&(FF''6l
l# ''
//
"
"(A(A(C
"
DFf	,335JGl% '( $$VX66   &&u-%%'11#++2L2LM	

 	m$s0   ;E$CBE$E!#A3EE$E!!E$N)__name__
__module____qualname____doc__staticmethodr   r3    r   r   r   r      s    4M M'7r   r   N)r7   
__future__r   r   r   apitools.base.pyr   r   googlecloudsdk.api_lib.pubsubr   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper   !googlecloudsdk.command_lib.pubsubr	   googlecloudsdk.corer
   DeleteCommandr   r9   r   r   <module>rB      s7    . &  ' 1 3 2 ( 2 #17T 17r   