
    A                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddl	mZ dd	lmZ dd
lmZ ddlZ ej"                  ej$                  j&                        ej(                   G d dej*                                      Z ej"                  ej$                  j.                         G d de             Z ej"                  ej$                  j2                         G d de             Zy)z-Command to create a new external VPN gateway.    )absolute_import)division)unicode_literals)base_classes)external_vpn_gateways_utils)arg_parsers)base)resource_manager_tags_utils)flagsNc                   >    e Zd ZdZddiZdZed        Zd Zd Z	d Z
y	)
Createa  Create a new Compute Engine external VPN gateway.

  *{command}* creates a new external VPN gateway.

  External VPN gateway is the on-premises VPN gateway or another cloud
  provider's VPN gateway that connects to your Google Cloud VPN gateway.
  To create a highly available VPN from Google Cloud to your on-premises side
  or another Cloud provider's VPN gateway, you must create an external VPN
  gateway resource in Google Cloud, which provides the information to
  Google Cloud about your external VPN gateway.
  EXAMPLESzw          To create an external VPN gateway, run:

              $ {command} my-external-gateway --interfaces=0=8.9.9.9Fc                    |j                   j                  t        j                         t        j                         | _        | j
                  j                  |d       | j                  r'|j                  dt        j                         dd       t        j                  |       |j                   j                  t        j                         y)z"Set up arguments for this command.create)operation_typez--resource-manager-tagsz	KEY=VALUEzj            A comma-separated list of Resource Manager tags to apply to the external VPN gateway.
        )typemetavarhelpN)display_info	AddFormatr   DEFAULT_LIST_FORMATExternalVpnGatewayArgumentEXTERNAL_VPN_GATEWAY_ARGAddArgument_support_tagging_at_creationadd_argumentr   ArgDictAddCreateExternalVpnGatewayArgsAddCacheUpdaterExternalVpnGatewaysCompleter)clsparsers     3lib/surface/compute/external_vpn_gateways/create.pyArgszCreate.Args4   s     !!%";";<#(#C#C#EC   ,,VH,M
''
#""$	   
))&1
''(J(JK    c                    t        j                  | j                               }t        j                  |      }| j
                  j                  ||j                        }|j                  j                  }t        j                  |j                  |      }t        j                  |j                  |      }| j                  r)|j                  | j!                  ||j                        }nd}|j#                  |j%                         |j&                  |||| j                        }	|j)                  ||	      }
|j+                  ||
d      }|S )z8Issues the request to create a new external VPN gateway.N)namedescription
interfacesredundancy_typeparamssupport_tagging_at_creationzCreating external VPN gateway)r   ComputeApiHolderReleaseTrackr   ExternalVpnGatewayHelperr   ResolveAsResource	resourcesclientmessagesr   ParseInterfacesr)   InferAndGetRedundancyTyper   resource_manager_tags_CreateExternalVpnGatewayParamsGetExternalVpnGatewayForInsertNamer(   r   WaitForOperation)selfargsholderhelperrefr3   r)   r*   r+   external_vpn_gateway_to_insertoperation_refrets               r#   _RunzCreate._RunF   s-   **4+<+<+>?F(AA&IF

'
'
9
9fC }}%%H&&tAJ55dooxPO))&&233
D..f f%+%J%JXXZ$$'$($E$E &K &" MM#'EFM

!
!];C Jr%   c                    t        j                  |      }|j                  }t        t	        j
                  |            D cg c]"  \  }}|j                  j                  ||      $ }}} ||j                  |            S c c}}w )N)keyvalue)additionalProperties)resourceManagerTags)r
   GetResourceManagerTagsExternalVpnGatewayParamssortedsix	iteritemsResourceManagerTagsValueAdditionalProperty)r;   r3   r6   resource_manager_tags_mapr+   rE   rF   additional_propertiess           r#   r7   z&Create._CreateExternalVpnGatewayParamsi   s    #::!	
 
 ..F !/H!IJJJC 	''::s%:PJ   ";;!6 < 
 	s   'Bc                 $    | j                  |      S )z7Issues API requests to construct external VPN gateways.)rC   )r;   r<   s     r#   Runz
Create.Runz   s    99T?r%   N)__name__
__module____qualname____doc__detailed_helpr   classmethodr$   rC   r7   rS    r%   r#   r   r      sF    
   H I-
 "'L L"!F"r%   r   c                       e Zd ZdZdZy)
CreateBetazeCreate a new Compute Engine external VPN gateway.

  *{command} creates a new External Vpn Gateway
  FNrT   rU   rV   rW   r   rZ   r%   r#   r\   r\      s     "'r%   r\   c                       e Zd ZdZdZy)CreateAlphazhCreate a new Compute Engine external VPN gateway.

  *{command}* creates a new external VPN gateway.

  TNr]   rZ   r%   r#   r_   r_      s    
 "&r%   r_   )rW   
__future__r   r   r   googlecloudsdk.api_lib.computer   4googlecloudsdk.api_lib.compute.external_vpn_gatewaysr   googlecloudsdk.callioper   r	   "googlecloudsdk.command_lib.computer
   8googlecloudsdk.command_lib.compute.external_vpn_gatewaysr   rL   ReleaseTracksr.   GAUniverseCompatibleCreateCommandr   BETAr\   ALPHAr_   rZ   r%   r#   <module>rl      s    4 &  ' 7 \ / ( J J 
 D%%(()\T \  *\~ D%%**+' ' ,' D%%++,&& & -&r%   