
                         z   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j,                  j2                        ej4                   G d dej6                                      Zy)z*Deletes a Backup and DR Management Server.    )absolute_import)division)unicode_literals)
exceptions)util)ManagementServersClient)base)flags)log)
console_ioc                   2    e Zd ZdZddddZed        Zd Zy)	DeleteAlphaz'Delete the specified Management Server.z$Deletes a specific management serverz{description}z        To delete a management server `sample-ms` in project `sample-project` and location `us-central1` , run:

          $ {command} sample-ms --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.
    TzName of the management server to delete. Before you delete, take a look at the prerequisites [here](https://cloud.google.com/backup-disaster-recovery/docs/configuration/decommission).N)r	   
ASYNC_FLAGAddToParser
SetDefaultr
   AddManagementServerResourceArg)parsers    2lib/surface/backup_dr/management_servers/delete.pyArgszDeleteAlpha.Args1   sA     	OO'OOvt,	((	f    c                    t               }|j                  }|j                  j                  j	                         }t        j                  ddd       	 |j                  |      }|r%t        j                  |j                   ddd       |S |j#                  |j%                  |      d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.
    zCThe management server will be deleted. You cannot undo this action.T)messagedefaultcancel_on_noNzmanagement serverz]Run the [gcloud backup-dr operations describe] command to check the status of this operation.)kindis_asyncdetailszJDeleting management server [{}]. (This operation could take up to 1 hour.)F)operation_refr   
has_result)r   async_CONCEPTSmanagement_serverParser   PromptContinueDeleteapitools_exceptions	HttpErrorr   HttpExceptionr   HTTP_ERROR_FORMATr   DeletedResourcenameWaitForOperationGetOperationRefformatRelativeName)selfargsclientr    r&   	operationes          r   RunzDeleteAlpha.RunA   s     %&F{{H77==? @-- 12i 	
.."7 "",,Y7##)6*;*H*H*J#K #   (( @$$Q(>(>??@s   C D$DDN)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r9    r   r   r   r       s4    
 0 6$-  /r   r   N)r=   
__future__r   r   r   apitools.base.pyr   r*   googlecloudsdk.api_lib.backupdrr   2googlecloudsdk.api_lib.backupdr.management_serversr   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper	   #googlecloudsdk.command_lib.backupdrr
   googlecloudsdk.corer   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyDeleteCommandr   r@   r   r   <module>rQ      s    1 '  ' > 0 V 2 ( 5 # 2 T..33T5F5F5I5I L$$$ L Lr   