
    3                     p   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 ddlmZ dd
lmZ ddlmZ ddiZ ej0                  ej2                  j4                  ej2                  j6                  ej2                  j8                         G d dej:                               Zy)zCommand to delete an operation.    )absolute_import)division)unicode_literals)
exceptions)operations_util)util)base)resource_args)log)
console_ioEXAMPLESa            To delete a Dataproc Metastore operation with the name
          `operation-1` in location `us-central1`, run:

          $ {command} operation-1 --location=us-central1

          To delete multiple Dataproc Metastore services with the name
          `operation-1` and `operation-2` in the same location
          `us-central1`, run:

          $ {command} operation-1 operation-2 --location=us-central1
        c                   *    e Zd ZdZeZed        Zd Zy)Deletez;Delete one or more completed Dataproc Metastore operations.c                 4    t        j                  | dd       y )Nz	to deleteT)plural)r
   AddOperationResourceArg)parsers    *lib/surface/metastore/operations/delete.pyArgszDelete.Args9   s    ))&+dK    c                    |j                   j                  j                         }t        j                  t        j                  d|D cg c]  }d|j                  d|j                  d! c}      ddd       d}|D ]^  }	 t        j                  |j                         | j                         	       d }t'        j(                  |j                         d
|       ` |rt+        j,                  d      y c c}w # t        j                  $ r7}t        j                   |      }|j"                  j$                  }d}Y d }~d }~ww xY w)Nz"Deleting the following operations:[z] in []TzDeletion aborted by user.)messagecancel_on_nocancel_stringthrow_if_unattendedF)release_track	operation)kindfailedzSome deletions did not succeed.)CONCEPTS
operationsParser   PromptContinuecommand_utilConstructListoperationsIdlocationsIdoperations_api_utilr   RelativeNameReleaseTrackapitools_exceptions	HttpErrorr   HttpExceptionpayloadstatus_messager   DeletedResourceapi_utilError)selfargsop_refsop_refencountered_errorsr!   eexcs           r   Runz
Delete.Run=   s/   mm&&,,.G**0%3%F #)"5"5v7I7IJ%3
 1 " """!1B1B1D	F 




k&B  NN<== -3 !** "&&q)++!"s   $C85C==E-EEN)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   r<    r   r   r   r   2   s&     D-L L>r   r   N)r@   
__future__r   r   r   apitools.base.pyr   r-    googlecloudsdk.api_lib.metastorer   r*   r   r3   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper	   $googlecloudsdk.command_lib.metastorer
   r&   googlecloudsdk.corer   googlecloudsdk.core.consoler   rA   ReleaseTracksr,   ALPHABETAGADeleteCommandr   rD   r   r   <module>rR      s    & &  ' > S = 2 ( > E # 2 	" D%%++T->->-C-C%%((*%>T %>*%>r   