
                         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  ej*                  ej,                  j.                  ej,                  j0                        ej2                   G d dej4                                      Zy)z%Deletes a Backup and DR Backup Vault.    )absolute_import)division)unicode_literals)
exceptions)util)BackupVaultsClient)base)flags)log)
console_ioc                   4    e Zd ZdZdddddZed        Zd Zy	)
Deletez"Delete the specified Backup Vault.zDeletes a specific backup vaultz{description}zThis command uses the backupdr/v1 API. The full documentation for this API can be found at: https://cloud.google.com/backup-disaster-recoverya          To delete a backup vault ``BACKUP_VAULT'' in location ``MY_LOCATION'', run:

        $ {command} BACKUP_VAULT --location=MY_LOCATION

        To override restrictions against the deletion of a backup vault ``BACKUP_VAULT''
        containing inactive datasources in location ``MY_LOCATION'', run:

        $ {command} BACKUP_VAULT --location=MY_LOCATION --ignore-inactive-datasources

        To override restrictions against the deletion of a backup vault ``BACKUP_VAULT''
        containing backup plan references in location ``MY_LOCATION'', run:

        $ {command} BACKUP_VAULT --location=MY_LOCATION --ignore-backup-plan-references
        )BRIEFDESCRIPTIONzAPI REFERENCEEXAMPLESc                     t        j                  | d       t        j                  |        t        j                  |        t        j                  |        t        j
                  | d       y)zySpecifies additional command flags.

    Args:
      parser: argparse.Parser: Parser object for command line inputs.
    zName of the backup vault to delete. Before you delete, take a look at the prerequisites [here](https://cloud.google.com/backup-disaster-recovery/docs/configuration/decommission).backup vaultN)r
   AddBackupVaultResourceArgAddNoAsyncFlag AddIgnoreInactiveDatasourcesFlag!AddIgnoreBackupPlanReferencesFlagAddAllowMissing)parsers    -lib/surface/backup_dr/backup_vaults/delete.pyArgszDelete.Args=   sW     
##	f 
 	**62	++F3	&.1    c           	      Z   t               }|j                  j                  j                         }|j                  }t        j                  ddd       	 |j                  ||j                  |j                  |j                        }|j#                  |      }|j                  rG|dk(  rBt%        j&                  |j(                  ddd	j+                  |j-                               
       |S |r1|j/                  |dj+                  |j-                               d      S t%        j&                  |j-                         ddt        j0                  j+                  |j(                        
       |S # t        j                  $ r)}t        j                  |t        j                         d}~ww xY w)zConstructs and sends request.

    Args:
      args: argparse.Namespace, An object that contains the values for the
        arguments specified in the .Args() method.

    Returns:
      ProcessHttpResponse of the request made.
    z>The backup vault will be deleted. You cannot undo this action.T)messagedefaultcancel_on_no)ignore_inactive_datasourcesignore_backup_plan_referencesallow_missingNNoner   Fz,= requested backup vault [{}] was not found.)kindis_asyncdetailszHDeleting backup vault [{}]. (This operation could take up to 2 minutes.))operation_refr   
has_result)r   CONCEPTSbackup_vaultParseno_asyncr   PromptContinuer   r!   r"   r#   apitools_exceptions	HttpErrorr   HttpExceptionr   HTTP_ERROR_FORMATGetOperationRefr   DeletedResourcenameformatRelativeNameWaitForOperationASYNC_OPERATION_MESSAGE)selfargsclientr+   r-   	operationer(   s           r   Runz
Delete.RunO   s     !F==--335L}}HL@--
&*&F&F(,(J(J**	   i **95Mmv5	
..<CC++-	 $$%((.|/H/H/J(K %   !!#,,33INNC	 C (( @$$Q(>(>??@s   3E. .F*$F%%F*N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r?    r   r   r   r      s9     + 1$?-2 2 2">r   r   N)rC   
__future__r   r   r   apitools.base.pyr   r/   googlecloudsdk.api_lib.backupdrr   -googlecloudsdk.api_lib.backupdr.backup_vaultsr   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper	   #googlecloudsdk.command_lib.backupdrr
   googlecloudsdk.corer   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackALPHAGADefaultUniverseOnlyDeleteCommandr   rF   r   r   <module>rV      s    , &  ' > 0 L 2 ( 5 # 2 D%%++T->->-A-ABlT l  Clr   