
    x                     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,                  ej.                  j0                  ej.                  j2                         G d dej4                                      Zy)zDeletes a Backup and DR Backup.    )absolute_import)division)unicode_literals)
exceptions)util)BackupsClient)base)flags)log)
console_ioc                   2    e Zd ZdZddddZed        Zd Zy)	DeletezDelete the specified Backup.zDeletes a specific backupz{description}a0          To delete a backup `sample-backup` in backup vault `sample-vault`, data source `sample-ds`, project `sample-project` and location `us-central1` , run:

          $ {command} sample-backup --backup-vault=sample-vault --data-source=sample-ds --project=sample-project --location=us-central1
        )BRIEFDESCRIPTIONEXAMPLESc                     t         j                  j                  |        t         j                  j                  | d       t	        j
                  | d       y)zySpecifies additional command flags.

    Args:
      parser: argparse.Parser: Parser object for command line inputs.
    TzName of the backup to delete.N)r	   
ASYNC_FLAGAddToParser
SetDefaultr
   AddBackupResourceArg)parsers    'lib/surface/backup_dr/backups/delete.pyArgszDelete.Args/   s>     	OO'OOvt,	'    c                    t               }|j                  }|j                  j                  j	                         }t        j                  ddd       	 |j                  |      }|rPt        j                  |j!                         ddt        j"                  j%                  |j&                               |S |j)                  |j+                  |      dj%                  |j!                               d	      }t        j                  |j!                         d
       |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.
    z8The backup will be deleted. You cannot undo this action.T)messagedefaultcancel_on_noNbackup)kindis_asyncdetailszYDeleting backup [{}]. (This operation usually takes 5 mins but could take up to 60 mins.)F)operation_refr   
has_result)r    )r   async_CONCEPTSr   Parser   PromptContinuer   apitools_exceptions	HttpErrorr   HttpExceptionr   HTTP_ERROR_FORMATr   DeletedResourceRelativeNameASYNC_OPERATION_MESSAGEformatnameWaitForOperationGetOperationRef)selfargsclientr!   r   	operationeresponses           r   Runz
Delete.Run=   s-    _F{{H]]!!'')FJ@--'i 	



..55innE	 &&,,Y7**0&1D1D1F*G ' H ++-H=O+ (( @$$Q(>(>??@s   D E1$EEN)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r:    r   r   r   r       s4     % +$-  ,r   r   N)r>   
__future__r   r   r   apitools.base.pyr   r)   googlecloudsdk.api_lib.backupdrr   'googlecloudsdk.api_lib.backupdr.backupsr   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper	   #googlecloudsdk.command_lib.backupdrr
   googlecloudsdk.corer   googlecloudsdk.core.consoler   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHAGADeleteCommandr   rA   r   r   <module>rQ      s    & '  ' > 0 A 2 ( 5 # 2 D%%++T->->-A-ABGT G C Gr   