
    
                         d Z ddlmZ ddlmZ ddlmZ ddl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                   G d de
j                               Zy)z%Command for spanner databases update.    )absolute_import)division)unicode_literalsN)database_operations)	databases)base)flags)resource_argsc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)Updatez Update a Cloud Spanner database.EXAMPLESa          To enable database deletion protection on a Cloud Spanner database
        'my-database', run:

          $ {command} my-database --enable-drop-protection

        To disable database deletion protection on a Cloud Spanner database
        'my-database', run:

          $ {command} my-database --no-enable-drop-protection

        To update KMS key references for a Cloud Spanner database
        'my-database', run:

          $ {command} my-database --kms-keys="KEY1,KEY2"
        c                    t        j                  | d       | j                  d      }t        j                         j                  |       t        j                         j                  |       t        j                  j                  |        y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go on
        the command line after this command. Positional arguments are allowed.
    z	to updateT)mutexN)	r
   AddDatabaseResourceArgadd_argument_groupr	   EnableDropProtectionAddToParserEnableUpdateKmsKeysr   
ASYNC_FLAG)parsergroup_parsers     'lib/surface/spanner/databases/update.pyArgszUpdate.Args5   sg     ((=,,4,8L	 ,,\:	++L9OO'    c                     t        j                  |j                  j                  j	                         |j
                  |j                        }|j                  r|S t        j                  |d      S )zThis is what gets called when the user runs the `database update` command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Database update response.
    zUpdating database.)
r   r   CONCEPTSdatabaseParseenable_drop_protectionkms_keysasync_r   Await)selfargsops      r   Runz
Update.RunC   s\     
		$$&##
B
 {{i$$R)=>>r   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   r&    r   r   r   r      s<    ( /(// # -& ( (?r   r   )r*   
__future__r   r   r   r+   googlecloudsdk.api_lib.spannerr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.spannerr	   r
   UniverseCompatibleUpdateCommandr   r/   r   r   <module>r6      sL    , &  '  > 4 ( 4 < 5?T 5? 5?r   