
    =                         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  G d de
j                        Zy)z,Command for spanner instance configs update.    )absolute_import)division)unicode_literalsN)instance_config_operations)instance_configs)base)flags)labels_utilc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)Updatez.Update a Cloud Spanner instance configuration.EXAMPLESaH          To update display name of a custom Cloud Spanner instance configuration 'custom-instance-config', run:

          $ {command} custom-instance-config --display-name=nam3-RO-us-central1

        To modify the instance config 'custom-instance-config' by adding label 'k0', with value 'value1' and label 'k1' with value 'value2' and removing labels with key 'k3', run:

         $ {command} custom-instance-config --update-labels=k0=value1,k1=value2 --remove-labels=k3

        To clear all labels of a custom Cloud Spanner instance configuration 'custom-instance-config', run:

          $ {command} custom-instance-config --clear-labels

        To remove an existing label of a custom Cloud Spanner instance configuration 'custom-instance-config', run:

          $ {command} custom-instance-config --remove-labels=KEY1,KEY2
        c                 (   | j                  ddt        j                  d       | j                  dd       | j                  dd	       t        j                  j                  |        t        j                  |        | j                  d
ddd       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.
    configINSTANCE_CONFIGz{Cloud Spanner instance config. The 'custom-' prefix is required to avoid name conflicts with Google-managed configurations.)metavar	completerhelpz--display-namez=The name of this instance configuration as it appears in UIs.)r   z--etagz(Used for optimistic concurrency control.z--validate-only
store_trueFzLUse this flag to validate that the request will succeed before executing it.)actiondefaultr   N)add_argumentr	   InstanceConfigCompleterr   
ASYNC_FLAGAddToParserr
   AddUpdateLabelsFlags)parsers    .lib/surface/spanner/instance_configs/update.pyArgszUpdate.Args5   s     !//F	  G L  N A  C 	OO'$$V,
[	      c                     t        j                  |      }|j                  s|j                  r|S t	        j
                  |d      S )zThis is what gets called when the user runs this command.

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

    Returns:
      Instance config update response.
    zUpdating instance-config)r   Patchasync_validate_onlyr   Await)selfargsops      r   Runz
Update.RunU   s>     
			%B {{d((i%++B0JKKr   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   r(    r   r   r   r      s<    6
(//  -*  >Lr   r   )r,   
__future__r   r   r   r-   googlecloudsdk.api_lib.spannerr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.spannerr	   $googlecloudsdk.command_lib.util.argsr
   UpdateCommandr   r1   r   r   <module>r8      s;    3 &  '  E ; ( 4 <ILT ILr   