
    "                     2   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 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 get-locations.    )absolute_import)division)unicode_literalsN)	instances)arg_parsers)base)flagsc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)MoveHMove the Cloud Spanner instance to the specified instance configuration.EXAMPLESa            To move the Cloud Spanner instance, which has two CMEK-enabled
          databases db1 and db2 and a database db3 with Google-managed
          encryption keys, to the target instance configuration nam3
          (us-east4, us-east1, us-central1), run:
          $ gcloud spanner instances move my-instance-id
            --target-config=nam3
            --target-database-move-configs=^:^database-id=db1:kms-key-names=projects/myproject/locations/us-east4/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-east1/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-central1/keyRings/mykeyring/cryptoKeys/cmek-key
            --target-database-move-configs=^:^database-id=db2:kms-key-names=projects/myproject/locations/us-east4/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-east1/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-central1/keyRings/mykeyring/cryptoKeys/cmek-key
        c           	      $   t        j                         j                  |        t        j                         j                  |        | j	                  ddt        j                  t        t        ddgd      t        j                         d       y	
a4  Args is called by calliope to gather arguments for this command.

    For `move` command, we have one positional argument, `instanceId`

    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--target-database-move-configsz2^:^database-id=DATABASE_ID:kms-key-names=KEY1,KEY2)database-idzkms-key-namesr   T)specrequired_keysrepeatedzDatabase level configurations for each database to be moved. Currently only used for CMEK-enabled databases to specificy the target database KMS keys.)metavartypeactionhelpN	r	   InstanceAddToParserTargetConfigadd_argumentr   	ArgObjectstrFlattenActionparsers    %lib/surface/spanner/instances/move.pyArgsz	Move.Args,        
NN  (	$$V,
(D"""!$ )/
 ((*)      c                 n    t        j                  |j                  |j                  |j                         yzThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. From `Args`, we extract command line
        arguments
    Nr   r   instancetarget_configtarget_database_move_configsselfargss     r"   RunzMove.RunK   '     NNt))4+L+Lr%   N
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr#   r/    r%   r"   r   r      ?     Q /(// 	# 	-  <	r%   r   c                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)BetaMover   r   a            To move the Cloud Spanner instance, which has two CMEK-enabled
          databases db1 and db2 and a database db3 with Google-managed
          encryption keys, to the target instance configuration nam3
          (us-east4, us-east1, us-central1), run:
          $ gcloud beta spanner instances move my-instance-id
            --target-config=nam3
            --target-database-move-configs=^:^database-id=db1:kms-key-names=projects/myproject/locations/us-east4/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-east1/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-central1/keyRings/mykeyring/cryptoKeys/cmek-key
            --target-database-move-configs=^:^database-id=db2:kms-key-names=projects/myproject/locations/us-east4/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-east1/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-central1/keyRings/mykeyring/cryptoKeys/cmek-key
        c           	      $   t        j                         j                  |        t        j                         j                  |        | j	                  ddt        j                  t        t        ddgd      t        j                         d       y	r   r   r    s    r"   r#   zBetaMove.Argsi   r$   r%   c                 n    t        j                  |j                  |j                  |j                         yr'   r(   r,   s     r"   r/   zBetaMove.Run   r0   r%   Nr1   r:   r%   r"   r=   r=   W   r;   r%   r=   c                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)	AlphaMover   r   a            To move the Cloud Spanner instance, which has two CMEK-enabled
          databases db1 and db2 and a database db3 with Google-managed
          encryption keys, to the target instance configuration nam3
          (us-east4, us-east1, us-central1), run:
          $ gcloud alpha spanner instances move my-instance-id
            --target-config=nam3
            --target-database-move-configs=^:^database-id=db1:kms-key-names=projects/myproject/locations/us-east4/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-east1/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-central1/keyRings/mykeyring/cryptoKeys/cmek-key
            --target-database-move-configs=^:^database-id=db2:kms-key-names=projects/myproject/locations/us-east4/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-east1/keyRings/mykeyring/cryptoKeys/cmek-key,projects/myproject/locations/us-central1/keyRings/mykeyring/cryptoKeys/cmek-key
        c           	      $   t        j                         j                  |        t        j                         j                  |        | j	                  ddt        j                  t        t        ddgd      t        j                         d       y	r   r   r    s    r"   r#   zAlphaMove.Args   r$   r%   c                 n    t        j                  |j                  |j                  |j                         yr'   r(   r,   s     r"   r/   zAlphaMove.Run   r0   r%   Nr1   r:   r%   r"   rA   rA      r;   r%   rA   )r5   
__future__r   r   r   r6   googlecloudsdk.api_lib.spannerr   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.spannerr	   DefaultUniverseOnlyReleaseTracksReleaseTrackGACommandr   BETAr=   ALPHArA   r:   r%   r"   <module>rO      s    3 &  '  4 / ( 4 D%%(()84<< 8 * 8v D%%**+8t|| 8 , 8v D%%++,8 8 - 8r%   