
                             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S.r\	R                  " \	R                   R"                  5       " S S\	R$                  5      5       rg)z.'vmware external-access-rules create' command.    )absolute_import)division)unicode_literals)ExternalAccessRulesClient)arg_parsers)base)flags)logz
          Create a VMware Engine external access firewall rule. Check the progress of a VMware Engine external access firewall rule creation using `{parent_command} list`.
        a~  
          To create an external access firewall rule called `my-external-access-rule`  associated with the network policy `my-network-policy` in the `us-west2` region, run:

            $ {command} my-external-access-rule --network-policy=my-network-policy --priority=1000 --ip-protocol=TCP --source-ranges=34.148.30.114/32 --destination-ranges=projects/sample-project/locations/us-west2-a/privateClouds/my-private-cloud/externalAddresses/my-external-address --source-ports=22,10000-11000 --destination-ports=22 --action=ALLOW --location=us-west2 --project=sample-project

          Or:

            $ {command} my-external-access-rule --network-policy=my-network-policy --priority=1000 --ip-protocol=TCP --source-ranges=34.148.30.114/32 --destination-ranges=projects/sample-project/locations/us-west2-a/privateClouds/my-private-cloud/externalAddresses/my-external-address --source-ports=22,10000-11000 --destination-ports=22

          In the second example, the project and the location are taken from gcloud properties core/project and compute/region respectively. The `--action` field also isn't specified, so its value defaults to `ALLOW`.
    )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)Create/   z5Create a VMware Engine external access firewall rule.c                    [         R                  " U SS9  [        R                  R	                  U 5        [        R                  R                  U S5        U R                  R                  S5        U R                  SSS9  U R                  SS[        R                  " SS	5      S
S9  U R                  SS/ SQSS9  U R                  SS[        R                  " SS9SSS9  U R                  SS[        R                  " SS9SSS9  U R                  S[        R                  " SS9SSS9  U R                  S[        R                  " SS9SSS9  U R                  S S!S"/S!S#S$9  g%)&z Register flags for this command.T)
positionalyamlz--descriptionzG        User-provided description of the external access rule.
        )helpz
--priorityd   i   z        Priority of this external access rule. Valid values are numbers between 100 and 4096, with 100 being the highest priority. Firewall rules are processed from highest to lowest priority.
        )requiredtyper   z--ip-protocol)TCPUDPICMPz\        Internet protocol covered by the rule. Valid values are TCP, UDP, and ICMP.
        )r   choicesr   z--source-ranges   )
min_lengthSOURCE_IP_RANGESz        A list of source IP addresses that the rule applies to. Each entry in the list can be a CIDR notation or a single IP address. When the value is set to `0.0.0.0/0`, all IP addresses are allowed.
        )r   r   metavarr   z--destination-rangesDESTINATION_IP_RANGESz        A list of destination IP addresses that the rule applies to. Each entry in the list can be an ExternalAddress resource name or `0.0.0.0/0`. When the value is set to `0.0.0.0/0`, all IP addresses are allowed.
        z--source-portsSOURCE_PORTSz_        List of allowed source ports. Each entry must be either an integer or a range.
        )r   r   r   z--destination-portsDESTINATION_PORTSzd        List of allowed destination ports. Each entry must be either an integer or a range.
        z--actionALLOWDENYz        Whether the firewall rule allows or denies traffic based on a successful rule match. By default, the action is ALLOW.
        )r   defaultr   N)r	   AddExternalAccessRuleToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argumentr   
BoundedIntArgList)parsers    Clib/surface/vmware/network_policies/external_access_rules/create.pyArgsCreate.Args4   s    
''4@OO'OOvt,
!!&)
  
 ##C.	   &	     A."     A.'     A.	     A.#	   &!	      c                 V   UR                   R                  R                  5       n[        5       nUR                  nUR                  UUR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                  S9	nU(       a!  [        R                  " UR                   SSS9  g UR#                  UR%                  U5      SR'                  UR)                  5       5      S9n[        R                  " UR)                  5       SS9  U$ )N)priorityip_protocolsource_rangesdestination_rangessource_portsdestination_portsdescriptionactionz"VMware Engine external access ruleT)kindis_asyncz3waiting for external access rule [{}] to be created)operation_refmessage)r<   )CONCEPTSexternal_access_ruleParser   async_r   r4   r5   r6   r7   r8   r9   r:   r;   r
   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)selfargsrA   clientr=   	operationresources          r/   Run
Create.Runt   s   ====CCE&(F{{H$$((22&&00$${{  
I 	
..3 &&,,Y7ELL --/
 ' H ))+1 Or2    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr0   rO   __static_attributes__rQ   r2   r/   r   r   /   s"    =-= =~ r2   r   N)rV   
__future__r   r   r   1googlecloudsdk.api_lib.vmware.externalaccessrulesr   googlecloudsdk.callioper   r   2googlecloudsdk.command_lib.vmware.network_policiesr	   googlecloudsdk.corer
   rW   ReleaseTracksReleaseTrackGACreateCommandr   rQ   r2   r/   <module>rd      sn    5 &  ' W / ( D #	
	( D%%(()dT d *dr2   