
                         ^   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  SSKrSrSr\\S.r\R(                  " \R*                  R,                  \R*                  R.                  \R*                  R0                  5       " S S\R2                  5      5       rg)%Reencrypts a Cloud SQL CMEK instance.    )
exceptions)api_util)
operations)validate)base)flags)log)
properties)
console_ioNzJ    Reencrypt a Cloud SQL CMEK instance with the primary key version.
    zk    To reencrypt a Cloud SQL CMEK instance with the primary key version:

    $ {command} instance-foo
    )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)	Reencrypt-   r   c                     [         R                  R                  U 5        U R                  S[        R
                  SS9  g)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.
instancezCloud SQL instance ID.)	completerhelpN)r   
ASYNC_FLAGAddToParseradd_argumentr	   InstanceCompleter)parsers    &lib/surface/sql/instances/reencrypt.pyArgsReencrypt.Args5   s8     	OO'
))%      c                    [         R                  " [         R                  5      nUR                  nUR                  nSn[
        R                  " UR                  5        UR                  R                  UR                  S[        R                  R                  R                  R                  0SS9n[        R                   " S5      (       d  g UR"                  R%                  UR'                  UR                  UR                  S95      nUR                  R)                  SUR*                  UR                  S9nUR,                  (       a=  UR.                  R1                  UR3                  UR                  UR4                  S	95      $ [.        R6                  R9                  X5S
5        g! [:        R<                   a-    [>        R@                  " S[B        RD                  " U5      5        e f = f)a  Reencrypts a Cloud SQL CMEK instance.

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

Returns:
  A dict object representing the operations resource describing the
  reencrypt operation if the reencryption was successful.
Nprojectzsql.instances)params
collectionzyWARNING: Reencryption will restart your instance if the primary key version is different from the instance's key version.)r   r    zsql.operations)	operationr    )r    r#   zReencrypting Cloud SQL instancezoperation : %s)#r   	SqlClientAPI_VERSION_DEFAULT
sql_clientsql_messagesr   ValidateInstanceNamer   resource_parserParser   VALUEScorer    	GetOrFailr   PromptContinue	instancesr   SqlInstancesReencryptRequestCreatenameasync_r   GetSqlOperationsGetRequestr#   OperationsV1Beta4WaitForOperationr   	HttpErrorr
   debugsix	text_type)selfargsclientr&   r'   operation_refinstance_refresults           r   RunReencrypt.RunD   s     < <=F""J&&LM!!$--0))//:,,1199CCD" 0 L $$	A  ##--

3
3#,,l6J6J 4 f ,,33
fkk<;O;O 4 m 
$$((00%--9P9P 1 
 	
 ""33
%F  	ii #--">?s   B9F* 	 F* *AG+ N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr   rB   __static_attributes__rD   r   r   r   r   -   s#     .- 4r   r   )rI   apitools.base.pyr   googlecloudsdk.api_lib.sqlr   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.sqlr	   googlecloudsdk.corer
   r   googlecloudsdk.core.consoler   r:   r   EXAMPLES_GArJ   ReleaseTracksReleaseTrackALPHABETAGACommandr   rD   r   r   <module>r[      s    , ( / 1 / ( 0 # * 2 
  T..33T5F5F5I5IH HHr   