
                          "   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SKJr  SSKJr  SSKr\R2                  \R4                  " \R6                  R8                  5       " S S\R:                  5      5       5       r\R4                  " \R6                  R>                  5       " S S\5      5       r \R4                  " \R6                  RB                  5       " S S\ 5      5       r"g)z,Command for creating Compute Engine routers.    )absolute_import)division)unicode_literals)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._Args0   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)r8   
short_help)add_mutually_exclusive_groupr   AddNccGatewayArgnetwork_flagsNetworkArgumentForOtherResourceNETWORK_ARGr&   )r1   r2   link_parsers      r3   r    &Create.add_ncc_gateway_and_network_argN   sO    55t5DK	;'#CC0CO OO,r6   c                 p    [         R                  " S5      U l        U R                  R                  U5        g )Nr9   )r=   r>   r?   r&   r0   s     r3   r   Create.add_network_argX   s+    #CC%CO OO'r6   c                 &    U R                  U5        g)zSee base.CreateCommand.N)r4   r0   s     r3   ArgsCreate.Args_   s     IIfr6   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)rU   rT   )
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clientrM   apitools_clientroutersr%   ResolveAsResourcer   RouterNamerI   r   ncc_gateway
nccGatewayr!   resource_manager_tags_CreateRouterParamsrW   networkr?   SelfLinkrJ   keepalive_interval	RouterBgpbgpIsSpecifiedrL   encryptedInterconnectRouterr   HasReplaceAdvertisementFlagsParseAdvertisementssix	iteritemssetattrbgp_identifier_rangehasattrrS   InsertComputeRoutersInsertRequestrT   rU   REGISTRYParserH   async_rX   r   CreatedResourcer   Pollerr   WaitFor)selfrO   holderrM   service
router_refrouter_resourcenetwork_refmodegroupsrangesattrsattrvalueresultoperation_reftarget_router_refoperation_pollers                     r3   _RunCreate._Rund   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 r6   c                 $    U R                  U5      $ )zSee base.UpdateCommand.)r   )r   rO   s     r3   Run
Create.Run   s    99T?r6   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sortedrr   rs   ResourceManagerTagsValueAdditionalProperty)r   rM   rg   resource_manager_tags_maprW   r   r   additional_propertiess           r3   rh   Create._CreateRouterParams   s    #::!	
 
 ""F !/H!IJJJC 	''::s:PJ   ";;!6 < 
 	s   %B  )__name__
__module____qualname____firstlineno____doc__r%   r   r!   classmethodr4   r    r   rE   r   r   rh   __static_attributes__r   r6   r3   r   r   #   s{     *!%@ @: - - ( (  hTr6   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   r6   r3   r   r      s     !%r6   r   c                        \ rS rSrSrSrSrSrg)CreateAlpha   r   Tr   Nr   r   r6   r3   r   r      s    
 !%r6   r   )#r   
__future__r   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   rr   UniverseCompatibleReleaseTracksr^   GACreateCommandr   BETAr   ALPHAr   r   r6   r3   <module>r      s    3 &  ' 7 < . / ( J N < C # ) 
 D%%(()|T | * |~ D%%**+& & ,& D%%++,&* & -&r6   