
    J                     @   S r SSKJr  SSKJr  SSKJr  SSK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\
R*                  " \
R,                  R.                  5      \
R0                   " S S\
R2                  5      5       5       r\
R*                  " \
R,                  R6                  5      \
R0                   " S S\5      5       5       r\
R*                  " \
R,                  R:                  5      \
R0                   " S S\5      5       5       rg)zCommand for creating networks.    )absolute_import)division)unicode_literalsN)base_classes)networks_utils)base)flags)network_utils)log)resource_projectorc                     SR                  U 5      n[        R                  R                  [        R
                  " U5      5        g)zText for firewall warning.a  
      Instances on this network will not be reachable until firewall rules
      are created. As an example, you can allow all internal traffic between
      instances as well as SSH, RDP, and ICMP by running:

      $ gcloud compute firewall-rules create <FIREWALL_NAME> --network {0} --allow tcp,udp,icmp --source-ranges <IP_RANGE>
      $ gcloud compute firewall-rules create <FIREWALL_NAME> --network {0} --allow tcp:22,tcp:3389,icmp
      N)formatr   statusPrinttextwrapdedent)network_namemessages     &lib/surface/compute/networks/create.py
EpilogTextr   !   s5    
 &
 
 **8??7+,    c                   D    \ rS rSrSrSrSrSr\S 5       r	S r
S	S jrSrg)
Create/   m  Create a Compute Engine network.

*{command}* is used to create virtual networks. A network
performs the same function that a router does in a home
network: it describes the network range and gateway IP
address, handles communication between instances, and serves
as a gateway between instances and callers outside the
network.

## EXAMPLES

To create a regional auto subnet mode network with the name 'network-name',
run:

  $ {command} network-name

To create a global custom subnet mode network with the name 'network-name',
run:

  $ {command} network-name \
    --bgp-routing-mode=global \
    --subnet-mode=custom

NTc                    UR                   R                  [        R                  5        [        R                  " 5       U l        U R
                  R                  USS9  [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                   " U5        ["        R$                  " S5      U l        U R&                  R                  U5        UR                   R)                  [        R*                  5        g Ncreate)operation_typez-The network profile to apply to this network.)display_info	AddFormatr	   LIST_FORMAT_WITH_ULA_IPV6NetworkArgumentNETWORK_ARGAddArgumentr
   AddCreateBaseArgsAddCreateSubnetModeArgAddCreateBgpRoutingModeArg	AddMtuArgAddInternalIpv6RangeArgAddEnableUlaInternalIpv6Arg+AddNetworkFirewallPolicyEnforcementOrderArgAddBgpBestPathSelectionArgGroup
AddTagsArgnetwork_profile_flags&NetworkProfileArgumentForOtherResourceNETWORK_PROFILE_ARGAddCacheUpdaterNetworksCompleterclsparsers     r   ArgsCreate.ArgsO   s   
!!%"A"AB++-COOOx@##F+((0,,V4F#))&1--f5==fE11&9V$ 	DD;	
 
 ''/
''(?(?@r   c                    [         R                  " U R                  5       5      nUR                  nUR                  n[
        R                  " U5        U R                  R                  XR                  5      nUR                  5       U l        U R                  R                  XR                  5      n[        R                  " UUUUU R                  S9nUR                   R"                  SUR                  R%                  XuR&                  S94nUR)                  U/5      n	[*        R,                  " U	S   5      n
[        R.                  " U
5      $ )z4Issues the request necessary for adding the network.)messagesnetwork_refnetwork_argsnetwork_profile_refsupport_firewall_orderInsert)networkprojectr   )r   ComputeApiHolderReleaseTrackclientr:   r
   CheckRangeLegacyModeOrRaiser$   ResolveAsResource	resourcesName_network_namer1   r   CreateNetworkResourceFromArgs_support_firewall_orderapitools_clientnetworksComputeNetworksInsertRequestrA   MakeRequestsr   MakeSerializableAddModesForListFormat)selfargsholderrD   r:   r;   r=   network_resourcerequestresponseresource_dicts              r   Run
Create.Runh   s$   **4+<+<+>?F]]FH--d3""44T;K;KLK$))+D22DD &CC/#;; 	''44$.A.A 	5 	
G ""G9-H&77DM//>>r   c                 .    [        U R                  5        g N)r   rI   )rR   resources_were_displayeds     r   EpilogCreate.Epilog   s    t!!"r   )rI   )T)__name__
__module____qualname____firstlineno____doc__r$   r1   rK   classmethodr7   rY   r^   __static_attributes__ r   r   r   r   /   s9    2 + A A0?B#r   r   c                   6   ^  \ rS rSrSr\U 4S j5       rSrU =r$ )
CreateBeta   r   c                 ,   > [         [        U ]  U5        g r\   )superri   r7   )r5   r6   	__class__s     r   r7   CreateBeta.Args   s    	*c'r   rg   )	r`   ra   rb   rc   rd   re   r7   rf   __classcell__)rm   s   @r   ri   ri      s    2 ( (r   ri   c                   0    \ rS rSrSrSrSr\S 5       rSr	g)CreateAlpha   aH  Create a Compute Engine network.

*{command}* is used to create virtual networks. A network
performs the same function that a router does in a home
network: it describes the network range and gateway IP
address, handles communication between instances, and serves
as a gateway between instances and callers outside the
network.
TNc                    UR                   R                  [        R                  5        [        R                  " 5       U l        U R
                  R                  USS9  [        R                  " S5      U l	        U R                  R                  U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                  " U5        [        R                   " U5        [        R"                  " U5        [        R$                  " U5        [        R&                  " U5        UR                   R)                  [        R*                  5        g r   )r    r!   r	   r"   r#   r$   r%   r/   r0   r1   r
   r&   r'   r(   r)   r*   r+   r,   r-   r.   r2   r3   r4   s     r   r7   CreateAlpha.Args   s
   
!!%"A"AB++-COOOx@DD;	
 
 ''/##F+((0,,V4F#))&1--f5==fE11&9V$
''(?(?@r   rg   )
r`   ra   rb   rc   rd   rK   r1   re   r7   rf   rg   r   r   rq   rq      s)     !A Ar   rq   )rd   
__future__r   r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   3googlecloudsdk.command_lib.compute.network_profilesr	   r/   +googlecloudsdk.command_lib.compute.networksr
   googlecloudsdk.corer   googlecloudsdk.core.resourcer   r   ReleaseTracksrC   GAUniverseCompatibleCreateCommandr   BETAri   ALPHArq   rg   r   r   <module>r      s    % &  '  7 9 ( ^ = E # ;- D%%(()Y#T Y#  *Y#x D%%**+( (  ,(> D%%++,$A* $A  -$Ar   