
    !                        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 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
)Create#   4Create a new AlloyDB cluster within a given project.z{description}zy        To create a new cluster, run:

          $ {command} my-cluster --region=us-central1 --password=postgres
        )DESCRIPTIONEXAMPLESc                 H   [         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                  " USSS9  [        R                  " XU R                  5       SS9  [        R                  " XR                  5       5        [        R                   " XU R                  5       5        [        R"                  " U5        [        R$                  " X5        [        R&                  " X5        [        R(                  " X5        [        R*                  " U5        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_infoF)updateN)r   GetMessagesModuleReleaseTrackr   
ASYNC_FLAGAddToParserr
   	AddRegion
AddCluster
AddNetworkAddPasswordAddAllocatedIPRangeNamekms_resource_argsAddKmsKeyResourceArgAddAutomatedBackupFlagsAddContinuousBackupConfigFlagsAddDatabaseVersionAddEnablePrivateServiceConnectAddMaintenanceWindowAddDenyMaintenancePeriodAddSubscriptionTypeAddTags)clsparseralloydb_messagess      &lib/surface/alloydb/clusters/create.pyArgsCreate.Args3   s#     11#2B2B2DEOO'	OOF	V	V	f	!!&)**9	 
!!#"2"2"4U 
((1A1A1CD	Vs7G7G7IJ	((0	v8	""6<	f7	MM&    c                 0    [         R                  " XU5      $ N)r	    ConstructCreateRequestFromArgsGAselfr.   location_refargss       r/   ConstructCreateRequestFromArgs%Create.ConstructCreateRequestFromArgsT   s    ::. .r2   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R/                  5       5      5        UR0                  (       d&  [2        R4                  " 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_parserr   r   VALUEScoreproject	GetOrFailregionr:   projects_locations_clustersr   REGISTRYParseRelativeNamenamer   statusPrintformatNameasync_r   Await)	r7   r9   clientrA   r.   r8   reqopop_refs	            r/   Run
Create.RunY   s    ##D$5$5$78F**N..))00$$$))11;;KK 1 !L 
-
-.>.24C		3	3	:	:3	?B11
C 2 EFJJ'..v{{}=>;;v'94;L;L;NOIr2    N)__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr0   r:   rV   __static_attributes__rX   r2   r/   r   r   #   s7     = 		-  @.
r2   r   c                   <   ^  \ rS rSrSr\U 4S j5       rS rSrU =r	$ )
CreateBetau   r   c                 ,   > [         [        U ]  U5        g r4   )superrb   r0   r,   r-   	__class__s     r/   r0   CreateBeta.Argsy   s    	*c'r2   c                 0    [         R                  " XU5      $ r4   )r	   "ConstructCreateRequestFromArgsBetar6   s       r/   r:   )CreateBeta.ConstructCreateRequestFromArgs}   s     << r2   rX   
rY   rZ   r[   r\   r]   r_   r0   r:   r`   __classcell__rg   s   @r/   rb   rb   u   s"    <( ( r2   rb   c                   <   ^  \ rS rSrSr\U 4S j5       rS rSrU =r	$ )CreateAlpha   r   c                 ,   > [         [        U ]  U5        g r4   )re   rp   r0   rf   s     r/   r0   CreateAlpha.Args   s    	+s (r2   c                 0    [         R                  " XU5      $ r4   )r	   #ConstructCreateRequestFromArgsAlphar6   s       r/   r:   *CreateAlpha.ConstructCreateRequestFromArgs   s     == r2   rX   rl   rn   s   @r/   rp   rp      s"    <) ) r2   rp   N)r]   
__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   BETArb   ALPHArp   rX   r2   r/   <module>r      s    % &  ' 3 = ( = 4 M # * ) D%%(()MT M * M` D%%**+  , D%%++,*  -r2   