
                         0   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  \R$                  " 5       r\R(                  " S5      r\R,                  " \R.                  R0                  5      \R2                   " S S\R4                  5      5       5       r\R,                  " \R.                  R8                  5       " S S\5      5       r\R,                  " \R.                  R<                  5       " S S\5      5       rg)z$Command to create a new VPN gateway.    )absolute_import)division)unicode_literals)base_classes)vpn_gateways_utils)arg_parsers)base)resource_manager_tags_utils)flagszC  A reference to a network to which the VPN gateway is attached.
  c                   L    \ rS rSrSrSS0rSr\S 5       rS r	S r
S	 rS
 rSrg)Create$     Create a new Compute Engine Highly Available VPN gateway.

*{command}* creates a new Highly Available VPN gateway.

Highly Available VPN Gateway provides a means to create a VPN solution with a
higher availability SLA compared to Classic Target VPN Gateway.
Highly Available VPN gateways are simply referred to as VPN gateways in the
API documentation and gcloud commands.
A VPN Gateway can reference one or more VPN tunnels that connect it to
external VPN gateways or Cloud VPN Gateways.
EXAMPLESz          To create a VPN gateway, run:

              $ {command} my-vpn-gateway --region=us-central1 --network=default
          Fc                    UR                   R                  [        R                  5        [        R                  U5        [        R                  USS9  U R                  (       a%  UR                  S[        R                  " 5       SSS9  [        R                  " 5       R                  U5        [        R                  " 5       R                  U5        [        R                  " 5       R                  U5        [        R                  " 5       R                  U5        UR                   R!                  [        R"                  5        g)"Set up arguments for this command.create)operation_typez--resource-manager-tagsz	KEY=VALUEza            A comma-separated list of Resource Manager tags to apply to the VPN gateway.
        )typemetavarhelpN)display_info	AddFormatr   DEFAULT_LIST_FORMAT_NETWORK_ARGAddArgument_VPN_GATEWAY_ARG_support_tagging_at_creationadd_argumentr   ArgDictGetDescriptionFlagAddToParserGetInterconnectAttachmentsFlagGetStackTypeGetGatewayIpVersionAddCacheUpdaterVpnGatewaysCompleter)clsparsers     *lib/surface/compute/vpn_gateways/create.pyArgsCreate.Args:   s     !!%";";<V$   A
''
#""$	   
**62	((*66v>	$$V,	++F3
''(B(BC    c                    [         R                  " U R                  5       5      n[        R                  " U5      nUR
                  R                  n[        R                  XR                  5      n[        R                  XR                  5      nSnSnUR                  b2  U R                  UUR                  UR                  UR                  5      nU R                  (       a(  UR                   b  U R#                  XAR                   5      nUR%                  UR'                  5       UR(                  UR+                  5       UUR,                  UR.                  U R                  US9n	UR1                  XY5      n
UR3                  XZS5      $ )z/Issues the request to create a new VPN gateway.N)namedescriptionnetwork,vpn_interfaces_with_interconnect_attachments
stack_typegateway_ip_versionsupport_tagging_at_creationparamszCreating VPN Gateway)r   ComputeApiHolderReleaseTrackr   VpnGatewayHelperclientmessagesr   ResolveAsResource	resourcesr   interconnect_attachments_mapInterconnectAttachmentsregionprojectr   resource_manager_tags_CreateVpnGatewayParamsGetVpnGatewayForInsertNamer0   SelfLinkr3   r4   r   WaitForOperation)selfargsholderhelperr;   vpn_gateway_refnetwork_refr6   r2   vpn_gateway_to_insertoperation_refs              r*   _RunCreate._RunO   s_   **4+<+<+>?F008F}}%%H&88?O?OPO007G7GHKF370$$0

*
*$$%%	 3 ((		#	#	/--00
 #99!!#$$$$&5a??22$($E$E : 	 MM/IM""(> r-   c                 .   UR                   n[        U5      S:X  a*  S[        R                  " X%S   X45      R	                  5       0$ [        R                  " X%S   X45      R	                  5       [        R                  " X%S   X45      R	                  5       S.$ )a:  Returns dict {interfaceId : interconnectAttachmentUrl} based on initial order of names in input interconnectAttachmentName and region and project of VPN Gateway.

Args:
  args: Namespace, argparse.Namespace.
  resources: Generates resource references.
  region: VPN Gateway region.
  project: VPN Gateway project.
   r   )r   rS   )r>   lenr   GetInterconnectAttachmentRefrF   )rH   rI   r=   r@   rA   attachment_refss         r*   r?   "Create._mapInterconnectAttachmentsv   s     33O
?q 
U//+VHJ  //+VHJ//+VHJ r-   c           	          [         R                  " U5      nUR                  n[        UR	                  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)keyvalue)additionalProperties)resourceManagerTags)r
   GetResourceManagerTagsVpnGatewayParamssorteditemsResourceManagerTagsValueAdditionalProperty)rH   r;   rB   resource_manager_tags_mapr6   rY   rZ   additional_propertiess           r*   rC   Create._CreateVpnGatewayParams   s    #::!	
 
 &&F !!:!@!@!BCCJC 	''::s:PC   ";;!6 < 
 	s   %A:c                 $    U R                  U5      $ zSee base.CreateCommand.rP   rH   rI   s     r*   Run
Create.Run       99T?r-    N)__name__
__module____qualname____firstlineno____doc__detailed_helpr   classmethodr+   rP   r?   rC   rj   __static_attributes__rm   r-   r*   r   r   $   sI    
    -
 "'D D(%N4"r-   r   c                   L   ^  \ rS rSrSrSrSrSrSr\	U 4S j5       r
S rSrU =r$ )	
CreateBeta   r   NTFc                 ,   > [         [        U ]  U5        gr   N)superrw   r+   r(   r)   	__class__s     r*   r+   CreateBeta.Args   s     
*c'r-   c                 $    U R                  U5      $ rg   rh   ri   s     r*   rj   CreateBeta.Run   rl   r-   rm   )rn   ro   rp   rq   rr   
ROUTER_ARGINSTANCE_ARG_support_outer_vpn_ipv6r   rt   r+   rj   ru   __classcell__r}   s   @r*   rw   rw      s<    
 *, !&( ( r-   rw   c                   H   ^  \ rS rSrSrSrSrSr\U 4S j5       r	S r
SrU =r$ )CreateAlpha   r   NTc                 ,   > [         [        U ]  U5        grz   )r{   r   r+   r|   s     r*   r+   CreateAlpha.Args   s     
+s (r-   c                 $    U R                  U5      $ rg   rh   ri   s     r*   rj   CreateAlpha.Run   rl   r-   rm   )rn   ro   rp   rq   rr   r   r   r   rt   r+   rj   ru   r   r   s   @r*   r   r      s6    
 *,!%) ) r-   r   N) rr   
__future__r   r   r   googlecloudsdk.api_lib.computer   +googlecloudsdk.api_lib.compute.vpn_gatewaysr   googlecloudsdk.callioper   r	   "googlecloudsdk.command_lib.computer
   +googlecloudsdk.command_lib.compute.networksr   network_flags/googlecloudsdk.command_lib.compute.vpn_gatewaysGetVpnGatewayArgumentr   NetworkArgumentForOtherResourcer   ReleaseTracksr8   GAUniverseCompatibleCreateCommandr   BETArw   ALPHAr   rm   r-   r*   <module>r      s    + &  ' 7 J / ( J N A ..0 << > 
 D%%(()}T }  *}@ D%%**+  ,: D%%++,&  -r-   