
                         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  e	j"                  e	j$                  j&                  e	j$                  j(                  e	j$                  j*                         G d de	j,                               Zy)z'Deletes a database in a given instance.    )absolute_import)division)unicode_literals)api_util)
operations)base)flags)log)
properties)
console_ioc                   &    e Zd ZdZed        Zd Zy)Deletez`Deletes a Cloud SQL database.

  For MySQL, also deletes all files in the database directory.
  c                     t        j                  |        t        j                  |        | j                  j	                  t         j
                         y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use it to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    N)r	   AddInstanceAddDatabaseNamedisplay_infoAddCacheUpdaterDatabaseCompleter)parsers    #lib/surface/sql/databases/delete.pyArgszDelete.Args&   s:     
f	&!
''(?(?@    c                 &   t        j                  t         j                        }|j                  }|j                  }t
        j                  j                  j                  j                  d      }|j                  j                  |j                  dt
        j                  j                  j                  j                  id      }t        j                  ddd       |j                   j#                  |j%                  ||j                  |j&                              }|j                  j)                  d	|j*                  |j                  
      }t,        j.                  j1                  ||d       t3        j4                  |j&                  d       y)zDeletes a Cloud SQL database.

    For MySQL, also deletes all files in the database directory.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      SQL database resource iterator.
    T)requiredprojectzsql.instances)params
collectionzmThe database will be deleted. Any data stored in the database will be destroyed. You cannot undo this action.)messagedefaultcancel_on_no)r   instancedatabasezsql.operations)	operationr   zDeleting Cloud SQL databaser"   N)r   	SqlClientAPI_VERSION_DEFAULT
sql_clientsql_messagesr   VALUEScorer   Getresource_parserParser!   	GetOrFailr   PromptContinue	databasesr   SqlDatabasesDeleteRequestr"   Createnamer   OperationsV1Beta4WaitForOperationr
   DeletedResource)	selfargsclientr&   r'   
project_idinstance_refresult_operationoperation_refs	            r   Runz
Delete.Run3   sV     < <=F""J&&L""''//33T3BJ))//:,,1199CCD" 0 $L
 :	 "++22.. 	/ 	PQ **11"''$$ 2 &M
   11*m2OQz2r   N)__name__
__module____qualname____doc__staticmethodr   r=    r   r   r   r      s"    
 
A 
A(3r   r   N)rA   
__future__r   r   r   googlecloudsdk.api_lib.sqlr   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.sqlr	   googlecloudsdk.corer
   r   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackGABETAALPHADeleteCommandr   rC   r   r   <module>rP      s    . &  ' / 1 ( 0 # * 2 D%%(($*;*;*@*@%%++-;3T ;3-;3r   