
                            d Z ddlmZ ddlmZ ddlmZ ddl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j2                   ej4                  ej6                  j8                  ej6                  j:                  ej6                  j<                         G d dej>                                      Z y)z:Command to delete one or more Dataproc Metastore services.    )absolute_import)division)unicode_literalsN)
exceptions)services_util)util)base)delete_util)resource_args)log)
console_ioEXAMPLESa            To delete a Dataproc Metastore service with the name
          `my-metastore-service` in location `us-central1`, run:

          $ {command} my-metastore-service --location=us-central1

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

          $ {command} service-1 service-2 --location=us-central1
        c                   *    e Zd ZdZeZed        Zd Zy)DeletezDelete one or more Dataproc Metastore services.

  If run asynchronously with `--async`, exits after printing
  one or more operation names that can be used to poll the status of the
  deletion(s) via:

    {top_command} metastore operations describe
  c                 v    t        j                  | dddd       t        j                  j	                  |        y )Nz	to deleteT)pluralrequired
positional)r   AddServiceResourceArgr	   
ASYNC_FLAGAddToParser)parsers    (lib/surface/metastore/services/delete.pyArgszDelete.ArgsB   s.    ''D4DJOO'    c                 p   |j                   j                  j                         }t        j                  t        j                  d|D cg c](  }dj                  |j                  |j                        * c}      ddd       t        j                  | j                               }d}|D ]  }d }d }	 t        j                  |j                         | j                               }dj                  |j                         }|j#                  |j                         |	       t/        j0                  |j                         dd|rd ndj                  |j                         |        |j2                  s|j5                         xs |}|rt7        j8                  d      y c c}w # t$        j&                  $ r1}	t)        j*                  |	j,                        d
   d   }d}Y d }	~	d }	~	ww xY w# t/        j0                  |j                         dd|rd ndj                  |j                         |       w xY w)Nz Deleting the following services:z[{}] in [{}]TzDeletion aborted by user.)messagecancel_on_nocancel_stringthrow_if_unattended)release_trackFzwith operation [{0}])service_name	operationerrorr   service)kindis_asyncdetailsfailedz)Some requested deletions did not succeed.)CONCEPTSservicesParser   PromptContinuecommand_utilConstructListformat
servicesIdlocationsIdr
   ServiceDeletionWaiterReleaseTrackservices_api_utilr   RelativeNamenameAddPendingDeleteapitools_exceptions	HttpErrorjsonloadscontentr   DeletedResourceasync_Waitapi_utilServiceDeleteError)
selfargsenv_refsenv_refwaiterencountered_errorsr#   r)   r(   es
             r   Runz
Delete.RunH   s
   }}%%++-H**+M#P
# !!'"4"4g6I6IJ#P
  1 " ..'')+Fif%,,  "$2C2C2EG	 )//	? --/9 	  	F 	  ".D")))..9	 , ;;!;;=>,>''
57 7 GP
" !** "AII&w/	:!" 	  ".D")))..9	s7   -F"43F''<G.'G+:'G&!G.&G++G..AH5N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   rJ    r   r   r   r   2   s%    
  -( (
(7r   r   )!rN   
__future__r   r   r   r;   apitools.base.pyr   r9    googlecloudsdk.api_lib.metastorer   r5   r   rA   googlecloudsdk.callioper	   $googlecloudsdk.command_lib.metastorer
   r   r.   googlecloudsdk.corer   googlecloudsdk.core.consoler   rO   DefaultUniverseOnlyReleaseTracksr4   ALPHABETAGADeleteCommandr   rR   r   r   <module>r`      s    A &  '  > O = ( < > E # 2 	" T..33T5F5F5I5I:7T :7 :7r   