
                         :   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  SrSr\
R,                  " \
R.                  R0                  5      \
R2                   " S S\
R4                  5      5       5       rg)z:Command to create a database migration private connection.    )absolute_import)division)unicode_literals)api_util)private_connections)resource_args)base)flags)concept_parsers)presentation_specs)logz.Create a Database Migration private connectionae      To create a private connection with VPC Peering called 'my-private-connection', run:

        $ {command} my-private-connection --region=us-central1 --display-name=my-private-connection --vpc=vpc-example --subnet=10.0.0.0/29

        To create a private connection with PSC Interface called 'my-privateConnection', run:

        $ {command} my-private-connection --location=us-central1 --display-name=my-private-connection --network-attachment=network-attachment-example

        To use a private connection, all migrations and connection profiles that use this configuration must be in the same region.


   c                   H    \ rS rSrSr\\S.r\S 5       r	\S 5       r
S rSrg)	Create/   z/Create a Database Migration private connection.)DESCRIPTIONEXAMPLESc                 Z   [         R                  " U S5        [        R                  " U 5        [        R                  " U 5        [        R
                  " U 5        [        R                  " U 5        [        R                  " U 5        U R                  SSS9nUR                  SS9nUR                  SSSS9  [        R                  " S	[         R                  " 5       S
USS9n[        R                  " U/5      R!                  U5        UR                  SS9n[        R"                  " U5        g)a  Common arguments for all release tracks.

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.
  release_track: Some arguments are added based on the command release
    track.
z	to createT)mutexrequiredz(Arguments for VPC Peering configuration.)helpz--subnetz)A free subnet for peering. (CIDR of /29).)r   r   z--vpcz,Resource ID of the VPC network to peer with.)groupr   z>Arguments for Private Service Connect Interface configuration.N)r   AddPrivateConnectionResourceArgpc_flagsAddDisplayNameFlagAddNoAsyncFlagAddSkipValidationFlagAddValidateOnlyFlagr
   AddLabelsCreateFlags	add_groupadd_argumentr   ResourcePresentationSpecGetVpcResourceSpecr   ConceptParserAddToParserAddNetworkAttachmentFlag)parserrelease_trackconfig_groupvpc_peering_groupvpc_spec	psc_groups         <lib/surface/database_migration/private_connections/create.py
CommonArgsCreate.CommonArgs5   s    11&+F'F#""6*  (	v&##$#>L$..7 /  ""< #  "::((*6H !!8*-99:KL &&M ' I %%i0    c                 `    [         R                  U [        R                  R                  5        g)z@Args is called by calliope to gather arguments for this command.N)r   r-   r	   ReleaseTrackGA)r&   s    r,   ArgsCreate.Argsb   s      fd//223r/   c                    UR                   R                  R                  5       nUR                  5       R	                  5       n[
        R                  " U R                  5       S9nUR                  X2R                  U5      n[        R                  " U R                  5       5      n[        R                  " U R                  5       5      n[        R                  " U R                  5       5      nUR                  S5      (       a  [        R                   R#                  SR%                  UR                  UR&                  5      5        [        R(                  " XeUR*                  5        [        R                   R#                  SR%                  UR                  UR&                  5      5        gUR                  SUR&                  UR,                  UR.                  S9n	UR0                  R3                  UR5                  U	R6                  S95      $ )	a  Create a Database Migration private connection.

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

Returns:
  A dict object representing the operations resource describing the create
  operation if the create was successful.
)r'   no_asyncz;Waiting for private connection [{}] to be created with [{}]z"Created private connection {} [{}]Nz+datamigration.projects.locations.operations)operationsId
projectsIdlocationsId)name)CONCEPTSprivate_connectionParseParentRelativeNamer   PrivateConnectionsClientr1   r   privateConnectionsIdr   GetClientInstanceGetMessagesModuleGetResourceParserIsKnownAndSpecifiedr   statusPrintformatr:   	HandleLRO%projects_locations_privateConnectionsr8   r9   projects_locations_operationsGet2DatamigrationProjectsLocationsOperationsGetRequestr7   )
selfargsprivate_connection_ref
parent_ref	pc_clientresult_operationclientmessagesresource_parseroperation_refs
             r,   Run
Create.Rung   s    "]]==CCE'..0==?J#<<'')+I ''??G ''(9(9(;<F))$*;*;*=>H001B1B1DEO
++	jj
G
N
N$99##%&
 EEG 
jj;BB
 
5
57G7L7LN O#**5%**)44*66	 + 8M //33CC++ 	D 	-. .r/    N)__name__
__module____qualname____firstlineno____doc__r   r   detailed_helpstaticmethodr-   r3   rX   __static_attributes__rZ   r/   r,   r   r   /   s=     8"-8D-*1 *1X 4 4,.r/   r   N)r_   
__future__r   r   r   )googlecloudsdk.api_lib.database_migrationr   r   r   googlecloudsdk.callioper	   -googlecloudsdk.command_lib.database_migrationr
   Agooglecloudsdk.command_lib.database_migration.private_connectionsr   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.corer   r   r   ReleaseTracksr1   r2   UniverseCompatibleCommandr   rZ   r/   r,   <module>rm      s    A &  ' > I C ( ? _ D G #> D%%(()b.T\\ b.  *b.r/   