
    "1                     >   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                   e
j                  e
j                   j"                         G d de
j$                                      Ze
j                   e
j                  e
j                   j(                         G d de
j$                                      Ze
j                   e
j                  e
j                   j,                         G d de
j$                                      Zy)z%Command for spanner instances update.    )absolute_import)division)unicode_literalsN)instance_operations)	instances)base)flags)resource_argsc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)Update Update a Cloud Spanner instance.EXAMPLES	          To update the display name of a Cloud Spanner instance, run:

          $ {command} my-instance-id --description=my-new-display-name

        To update the node count of a Cloud Spanner instance, run:

          $ {command} my-instance-id --nodes=1
        c           	         t        j                         j                  |        t        j                  d      j                  |        t        j
                  j                  |        t        j                  |        t        j                  |        t        j                  d| ddddd       t        j                  dd      j                  |        t        j                  dddd	
      j                  |        yx  Args is called by calliope to gather arguments for this command.

    Please add arguments in alphabetical order except for no- or a clear-
    pair for that argument which can follow the argument itself.
    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.
    FrequiredT)require_all_autoscaling_argsparseradd_asymmetric_option_flagasymmetric_options_group$add_asymmetric_total_cpu_target_flag(add_asymmetric_disable_autoscaling_flagsautoscaling_cpu_target_groupNNot specified.bNo default backup schedule is created automatically when a new database is created in an instance.  A default backup schedule is created automatically when a new database is created in an instance. You can edit or delete the default backup schedule once it's created. The default backup schedule creates a full backup every 24 hours. These full backups are retained for 7 days.(DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIEDNONE	AUTOMATICchoicesr	   InstanceAddToParserDescriptionr   
ASYNC_FLAGr
   AddExpireBehaviorArgAddInstanceTypeArgAddCapacityArgsForInstanceEditionDefaultBackupScheduleTyper   s    'lib/surface/spanner/instances/update.pyArgszUpdate.Args/        
NN  (	u%11&9OO'&&v.$$V,	$$%*#'!%-115%) 
MM$))&1	##8H79
 k&    c                 T   t        j                  |      }t        j                  |      }t        j                  |j
                  fi d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d	|j                  d
|j                  d|j                   d|j"                  d|d|d|j$                  d|j&                  }|j(                  r|S t+        j,                  |d       yThis 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:
      Some value that we want to have printed later.
    descriptionnodesprocessing_unitsautoscaling_min_nodesautoscaling_max_nodes autoscaling_min_processing_units autoscaling_max_processing_units$autoscaling_high_priority_cpu_targetautoscaling_total_cpu_targetautoscaling_storage_targetasymmetric_autoscaling_options$clear_asymmetric_autoscaling_optionsinstance_typeexpire_behavioreditiondefault_backup_schedule_typeUpdating instanceNr
   GetInstanceTypeGetExpireBehaviorr   Patchinstancer7   r8   r9   r:   r;   r<   r=   r>   r?   r@   asymmetric_autoscaling_option#clear_asymmetric_autoscaling_optionrE   rF   async_r   AwaitselfargsrC   rD   ops        r0   Runz
Update.RunY   F    "11$7M#55d;O	
$$
 jj
 ..	

 #88
 #88
 *.)N)N
 *.)N)N
 .2-V-V
 &*%F%F
 $(#B#B
 (,'I'I
 .2-U-U
 $
 (
  !
" &*%F%F#
B& {{ib"56r3   N
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr1   rU    r3   r0   r   r      ?     ) /(// # 
- ' 'R"7r3   r   c                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)
BetaUpdater   r   r   c           	         t        j                         j                  |        t        j                  d      j                  |        t        j
                  j                  |        t        j                  |        t        j                  |        t        j                  d| ddddd       t        j                  dd      j                  |        t        j                  dddd	
      j                  |        yr   r%   r/   s    r0   r1   zBetaUpdate.Args   r2   r3   c                 T   t        j                  |      }t        j                  |      }t        j                  |j
                  fi d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d	|j                  d
|j                  d|j                   d|j"                  d|d|d|j$                  d|j&                  }|j(                  r|S t+        j,                  |d       yr5   rH   rQ   s        r0   rU   zBetaUpdate.Run   rV   r3   NrW   r`   r3   r0   rc   rc   ~   ra   r3   rc   c                   f    e Zd ZdZd ej
                  d      iZej                  Zed        Z	d Z
y)AlphaUpdatez4Update a Cloud Spanner instance with ALPHA features.r   r   c           
      B   t        j                         j                  |        t        j                  d      j                  |        t        j
                  j                  |        t        j                  |        t        j                  |        t        j                  d| dddddd       t        j                         j                  |        t        j                  dd      j                  |        t        j                  dddd	
      j                  |        y)r   Fr   T)r   r   r   r   r   r   r   add_disable_downscaling_flagNr   r   r   r   r#   )r	   r&   r'   r(   r   r)   r
   r*   r+   r,   SsdCacher-   r.   r/   s    r0   r1   zAlphaUpdate.Args   s     
NN  (	u%11&9OO'&&v.$$V,	$$%*#'!%%)-115%)	 
NN  (	MM$))&1	##8H79
 k&r3   c                 n   t        j                  |      }t        j                  |      }t        j                  |j
                  fi d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d	|j                  d
|j                  d|j                   d|j"                  d|d|d|j$                  d|j&                  d|j(                  }|j*                  r|S t-        j.                  |d       y)r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   ssd_cache_idrE   rF   rG   N)r
   rI   rJ   r   rK   rL   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rM   rN   	ssd_cacherE   rF   rO   r   rP   rQ   s        r0   rU   zAlphaUpdate.Run  sT    "11$7M#55d;O	
$$
 jj
 ..	

 #88
 #88
 *.)N)N
 *.)N)N
 .2-V-V
 &*%F%F
 $(#B#B
 (,'I'I
 .2-U-U
 $
 (
  ^^!
" #
$ &*%F%F%
B( {{ib"56r3   N)rX   rY   rZ   r[   r\   r]   r^   r   r_   r1   rU   r`   r3   r0   rg   rg      sH     = /(// # 
- NN'* *X#7r3   rg   )r[   
__future__r   r   r   r\   googlecloudsdk.api_lib.spannerr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.spannerr	   r
   DefaultUniverseOnlyReleaseTracksReleaseTrackGACommandr   BETArc   ALPHArg   r`   r3   r0   <module>ry      s   , &  '  > 4 ( 4 < D%%(()[7T\\ [7 * [7| D%%**+[7 [7 , [7| D%%++,a7$,, a7 - a7r3   