
                            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Jr  SSKJr  SSKJr  \	R(                  \	R*                  " \	R,                  R.                  5       " S S\	R0                  5      5       5       r\	R*                  " \	R,                  R4                  5       " S S\5      5       r\	R*                  " \	R,                  R8                  5       " S S\5      5       rg)z(Creates a new AlloyDB secondary cluster.    )absolute_import)division)unicode_literals)api_util)cluster_operations)base)cluster_helper)flags)resource_args)log)
properties)	resourcesc                   >    \ rS rSrSrSSS.r\S 5       rS rS r	S	r
g
)CreateSecondary    >Create a new AlloyDB SECONDARY cluster within a given project.z{description}z        To create a new cluster, run:

          $ {command} my-cluster --region=us-central1 --primary-cluster=projects/12345/locations/us-central1/clusters/cluster1
        )DESCRIPTIONEXAMPLESc                    [         R                  " U R                  5       5      n[        R                  R                  U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " X5        [        R                  " U5        [        R                  " USSS9  g)zmSpecifies additional command flags.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
clusterzjThe 'AlloyDB Service Agent' service account must hold permission 'Cloud KMS CryptoKey Encrypter/Decrypter')permission_infoN)r   GetMessagesModuleReleaseTrackr   
ASYNC_FLAGAddToParserr
   	AddRegion
AddClusterAddPrimaryClusterAddAllocatedIPRangeName0AddContinuousBackupConfigFlagsForCreateSecondary)AddAutomatedBackupFlagsForCreateSecondaryAddTagskms_resource_argsAddKmsKeyResourceArg)clsparseralloydb_messagess      0lib/surface/alloydb/clusters/create_secondary.pyArgsCreateSecondary.Args.   s      11#2B2B2DEOO'	OOF	V	F#	!!&)	::6B	33FM	MM&**9	    c                 0    [         R                  " XU5      $ N)r	   )ConstructCreatesecondaryRequestFromArgsGAselfr'   location_refargss       r(   'ConstructCreateSecondaryRequestFromArgs7CreateSecondary.ConstructCreateSecondaryRequestFromArgsG   s    CC. .r+   c                    [         R                  " U R                  5       5      nUR                  nUR                  nUR
                  R                  S[        R                  R                  R                  R                  UR                  S9nU R                  XEU5      nUR                  R                  U5      n[         R"                  R%                  UR&                  SS9n[(        R*                  R-                  SR/                  UR1                  5       5      5        UR2                  (       d&  [4        R6                  " USU R                  5       5        U$ )zConstructs and sends request.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the .Args() method.

Returns:
  ProcessHttpResponse of the request made
zalloydb.projects.locations)
projectsIdlocationsIdz%alloydb.projects.locations.operations)
collectionzOperation ID: {}zCreating cluster)r   AlloyDBClientr   alloydb_clientr'   resource_parserCreater   VALUEScoreproject	GetOrFailregionr3   projects_locations_clustersCreatesecondaryr   REGISTRYParseRelativeNamenamer   statusPrintformatNameasync_r   Await)	r0   r2   clientr:   r'   r1   reqopop_refs	            r(   RunCreateSecondary.RunL   s    ##D$5$5$78F**N..))00$$$))11;;KK 1 L
 
6
6C 
	3	3	C	CC	HB11
C 2 F JJ'..v{{}=>;;v'94;L;L;NOIr+    N)__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr)   r3   rQ   __static_attributes__rS   r+   r(   r   r       s7     G %-  0.
r+   r   c                   <   ^  \ rS rSrSr\U 4S j5       rS rSrU =r	$ )CreateSecondaryBetal   r   c                 ,   > [         [        U ]  U5        g r-   )superr]   r)   r%   r&   	__class__s     r(   r)   CreateSecondaryBeta.Argsp   s    	
s(0r+   c                 0    [         R                  " XU5      $ r-   )r	   +ConstructCreatesecondaryRequestFromArgsBetar/   s       r(   r3   ;CreateSecondaryBeta.ConstructCreateSecondaryRequestFromArgst   s    EE. .r+   rS   
rT   rU   rV   rW   rX   rZ   r)   r3   r[   __classcell__rb   s   @r(   r]   r]   l   s"    F1 1. .r+   r]   c                   <   ^  \ rS rSrSr\U 4S j5       rS rSrU =r	$ )CreateSecondaryAlphaz   r   c                 ,   > [         [        U ]  U5        g r-   )r`   rk   r)   ra   s     r(   r)   CreateSecondaryAlpha.Args~   s    	
)&1r+   c                 0    [         R                  " XU5      $ r-   )r	   ,ConstructCreatesecondaryRequestFromArgsAlphar/   s       r(   r3   <CreateSecondaryAlpha.ConstructCreateSecondaryRequestFromArgs   s     FF r+   rS   rg   ri   s   @r(   rk   rk   z   s"    F2 2 r+   rk   N)rX   
__future__r   r   r   googlecloudsdk.api_lib.alloydbr   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.alloydbr	   r
   googlecloudsdk.command_lib.kmsr   r#   googlecloudsdk.corer   r   r   DefaultUniverseOnlyReleaseTracksr   GACreateCommandr   BETAr]   ALPHArk   rS   r+   r(   <module>r~      s    / &  ' 3 = ( = 4 M # * ) D%%(()Gd(( G * GT D%%**+
./ 
. ,
. D%%++,.  -r+   