
    !                     |   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lmZ ddiZ ej2                  ej4                  j6                  ej4                  j8                  ej4                  j:                         G d dej<                               Zy)z=Command to delete one or more Dataproc Metastore federations.    )absolute_import)division)unicode_literals)
exceptions)federations_util)util)base)delete_util)resource_args)log)
console_ioEXAMPLESa            To delete a Dataproc Metastore federation with the name
          `my-metastore-federation` in location `us-central1`, run:

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

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

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

  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   AddFederationResourceArgr	   
ASYNC_FLAGAddToParser)parsers    +lib/surface/metastore/federations/delete.pyArgszDelete.Args?   s.    **D4DJOO'    c                 F   |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                               }|j!                  |j                         |       t/        j0                  |j                         d	d|rd nd
j                  |j2                        |        |j4                  s|j7                         xs |}|rt9        j:                  d      y c c}w # t"        j$                  $ r7}t'        j(                  |      }	|	j*                  j,                  }d}Y d }~d }~ww xY w# t/        j0                  |j                         d	d|rd nd
j                  |j2                        |       w xY w)Nz#Deleting the following federations:z[{}] in [{}]TzDeletion aborted by user.)messagecancel_on_nocancel_stringthrow_if_unattended)release_trackF)federation_name	operation
federationzwith operation [{0}])kindis_asyncdetailsfailedz)Some requested deletions did not succeed.)CONCEPTSfederationsParser   PromptContinuecommand_utilConstructListformatfederationsIdlocationsIdr
   FederationDeletionWaiterReleaseTrackfederations_api_utilr   RelativeNameAddPendingDeleteapitools_exceptions	HttpErrorr   HttpExceptionpayloadstatus_messager   DeletedResourcenameasync_Waitapi_utilFederationDeleteError)
selfargsenv_refsenv_refwaiterencountered_errorsr#   r(   eexcs
             r   Runz
Delete.RunE   s   }}((..0H**1  (4  (G %%g&;&;&-&9&9;'4 1 	" 11'')+Fif(//  "$2C2C2EG	 	#002i 	  	I 	  ".D")))..9	 , ;;!;;=>,>**
57 7 I4$ !** "&&q)++!" 	  ".D")))..9	s7   -F43F'!GG-GGGGAH N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   rJ    r   r   r   r   1   s%      -( (
*7r   r   N) rN   
__future__r   r   r   apitools.base.pyr   r7    googlecloudsdk.api_lib.metastorer   r4   r   r@   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper	   $googlecloudsdk.command_lib.metastorer
   r   r-   googlecloudsdk.corer   googlecloudsdk.core.consoler   rO   ReleaseTracksr3   ALPHABETAGADeleteCommandr   rR   r   r   <module>r`      s    D &  ' > U = 2 ( < > E # 2 	" D%%++T->->-C-C%%((*<7T <7*<7r   