
    ]                         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r\	R*                  \	R,                  " \	R.                  R0                  5       " S S\	R2                  5      5       5       r\	R,                  " \	R.                  R6                  5       " S S\5      5       r\	R,                  " \	R.                  R:                  5       " S S\5      5       rg)z,Command for creating Compute Engine routers.    )base_classes)poller)waiter)arg_parsers)base)resource_manager_tags_utils)flags)router_utils)log)	resourcesNc                   v    \ rS rSrSrSrSrSr\S 5       r	\S 5       r
\S 5       r\S	 5       rS
 rS rS rSrg)Create    Create a Compute Engine router.

*{command}* is used to create a router to provide dynamic routing to VPN
tunnels and interconnects.
NFTc                     UR                   R                  [        R                  5        U R                  (       d  U R                  U5        OU R                  U5        U R                  (       a%  UR                  S[        R                  " 5       SSS9  [        R                  " 5       U l        U R                  R                  USS9  [        R                  R!                  U5        [        R"                  " U5        [        R$                  " U5        [        R&                  " U5        [        R(                  " U5        [        R*                  " US5        UR                   R-                  [        R.                  5        g )Nz--resource-manager-tagsz	KEY=VALUEaF              Comma-separated list of Resource Manager tags to attach to the router. Key-value pairs must be provided in the form tagKeys/{TagKey_Numeric_ID}=tagValues/{TagValue_Numeric_ID}.
            See [Listing tag keys](https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#listing_keys).
        )typemetavarhelpcreate)operation_typerouter)display_info	AddFormatr	   DEFAULT_CREATE_FORMAT_support_ncc_gatewayadd_network_argadd_ncc_gateway_and_network_arg_support_tagging_at_creationadd_argumentr   ArgDictRouterArgument
ROUTER_ARGAddArgumentr   
ASYNC_FLAGAddToParserAddCreateRouterArgsAddKeepaliveIntervalArgAddBgpIdentifierRangeArgAddEncryptedInterconnectRouter!AddReplaceCustomAdvertisementArgsAddCacheUpdaterRoutersCompleterclsparsers     %lib/surface/compute/routers/create.py_ArgsCreate._Args-   s   
!!%"="=>##	&!	))&1
''
#""$	   ))+CNNNvh?OO'	f%	!!&)	""6*	((0	++FH=
''(>(>?    c                     UR                  SS9n[        R                  " U5        [        R                  " SSS9U l        U R
                  R                  U5        g )NT)requiredFThe network for this router)r5   
short_help)add_mutually_exclusive_groupr	   AddNccGatewayArgnetwork_flagsNetworkArgumentForOtherResourceNETWORK_ARGr#   )r.   r/   link_parsers      r0   r   &Create.add_ncc_gateway_and_network_argK   sO    55t5DK	;'#CC0CO OO,r3   c                 p    [         R                  " S5      U l        U R                  R                  U5        g )Nr6   )r:   r;   r<   r#   r-   s     r0   r   Create.add_network_argU   s+    #CC%CO OO'r3   c                 &    U R                  U5        g)zSee base.CreateCommand.N)r1   r-   s     r0   ArgsCreate.Args\   s     IIfr3   c                 B   [         R                  " U R                  5       5      nUR                  R                  nUR                  R
                  R                  nU R                  R                  XR                  5      nUR                  UR                  5       UR                  S9nU R                  (       a  UR                  b  UR                  Ul        U R                   (       a-  UR"                  b   U R%                  X1R"                  5      Ul        UR(                  b:  U R*                  R                  XR                  5      nUR-                  5       Ul        UR.                  c  UR0                  b)  UR3                  UR.                  UR0                  S9Ul        UR7                  S5      (       a  UR8                  Ul        [<        R>                  " U5      (       a  [<        R@                  " X3R2                  US9u  pn
UU	U
S.nUR.                  c  UR3                  5       Ul        [B        RD                  " U5       H   u  pUc  M
  [G        UR4                  X5        M"     URH                  bK  [K        UR4                  S5      (       d  UR3                  5       Ul        URH                  UR4                  l&        URO                  URQ                  UURR                  URT                  S95      n[        RV                  RY                  URZ                  SURT                  URR                  S	.S
9nUR\                  (       aS  UR7                  S5      (       d  SUl/        [`        Rb                  " USR_                  UR                  5       5      SSS9  U$ UR                  RY                  UR                  5       SURT                  URR                  S	.S
9n[d        Rf                  " UU5      n[h        Rj                  " UUSR_                  UR                  5       5      5      $ )N)namedescription)asnkeepaliveIntervalencrypted_interconnect_router)messagesresource_classargs)advertiseModeadvertisedGroupsadvertisedIpRangesidentifierRange)r   regionprojectzcompute.regionOperations)rR   rQ   )
collectionparamsformatnonezrouter [{0}]Tz[Run the [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetailszcompute.routerszCreating router [{0}])6r   ComputeApiHolderReleaseTrackclientrJ   apitools_clientroutersr"   ResolveAsResourcer   RouterNamerF   r   ncc_gateway
nccGatewayr   resource_manager_tags_CreateRouterParamsrT   networkr<   SelfLinkrG   keepalive_interval	RouterBgpbgpIsSpecifiedrI   encryptedInterconnectRouterr
   HasReplaceAdvertisementFlagsParseAdvertisementssix	iteritemssetattrbgp_identifier_rangehasattrrP   InsertComputeRoutersInsertRequestrQ   rR   REGISTRYParserE   async_rU   r   CreatedResourcer   Pollerr   WaitFor)selfrL   holderrJ   service
router_refrouter_resourcenetwork_refmodegroupsrangesattrsattrvalueresultoperation_reftarget_router_refoperation_pollers                     r0   _RunCreate._Runa   s   **4+<+<+>?F}}%%Hmm++33G2249I9IJJoo__$$ & O
   				%%)%5%5"((		#	#	/!%!9!900"
 ||$$66t=M=MNk + 4 4 6o xxt66B$..hh$*A*A / o 788

,
, 1 0066)==,>,>TdF
  $ &e 
	&002u-+$
/%%t
3 .   ,_((*;<<&002,0,E,Eo)^^,,"$$&& 	- 	
F &&,,-!)) ''
 - M {{h''	
$$Z__%677 m((..$!)) ''
 /  }}W.?@>>&&z'89 r3   c                 $    U R                  U5      $ )zSee base.UpdateCommand.)r   )r|   rL   s     r0   Run
Create.Run   s    99T?r3   c           	         [         R                  " U5      nUR                  n[        [        R
                  " U5      5       VVs/ s H  u  pVUR                  R                  XVS9PM      nnnU" UR                  US9S9$ s  snnf )N)keyr   )additionalProperties)resourceManagerTags)r   GetResourceManagerTagsRouterParamssortedro   rp   ResourceManagerTagsValueAdditionalProperty)r|   rJ   rd   resource_manager_tags_maprT   r   r   additional_propertiess           r0   re   Create._CreateRouterParams   s    #::!	
 
 ""F !/H!IJJJC 	''::s:PJ   ";;!6 < 
 	s   %B  )__name__
__module____qualname____firstlineno____doc__r"   r   r   classmethodr1   r   r   rB   r   r   re   __static_attributes__r   r3   r0   r   r       s{     *!%@ @: - - ( (  hTr3   r   c                        \ rS rSrSrSrSrSrg)
CreateBeta   r   Tr   Nr   r   r   r   r   r   r   r   r   r3   r0   r   r      s     !%r3   r   c                        \ rS rSrSrSrSrSrg)CreateAlpha   r   Tr   Nr   r   r3   r0   r   r      s    
 !%r3   r   )r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   +googlecloudsdk.command_lib.compute.networksr	   r:   *googlecloudsdk.command_lib.compute.routersr
   googlecloudsdk.corer   r   ro   UniverseCompatibleReleaseTracksr[   GACreateCommandr   BETAr   ALPHAr   r   r3   r0   <module>r      s    3 8 < . / ( J N < C # ) 
 D%%(()|T | * |~ D%%**+& & ,& D%%++,&* & -&r3   