
    2                        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  \R4                  " \R6                  R8                  \R6                  R:                  \R6                  R<                  5       " S S\R>                  5      5       r SSS.\ l!        g)z2Command for adding a Rule to a Compute Engine NAT.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)flags)
nats_utils)rules_utils)log)	resourcesc                   .    \ rS rSrSr\S 5       rS rSrg)Create!   z#Add a Rule to a Compute Engine NAT.c                    [         R                  " 5       U l        U R                  R                  U5        [        R
                  " USSS9  [        R                  " U5        [        R                  " USSS9  [        R                  " USS9  [        R                  " U5        [        R                  R                  U5        g )NcreateF)operation_typepluralNAT)r   T)required)routers_flagsRouterArgumentForNat
ROUTER_ARGAddArgumentrules_flagsAddRuleNumberArgAddNatNameArgcompute_flagsAddRegionFlagAddMatchArgAddIpAndRangeArgsForCreater	   
ASYNC_FLAGAddToParser)clsparsers     0lib/surface/compute/routers/nats/rules/create.pyArgsCreate.Args'   s    "779CNNNv&  Of%hGFT2**62OO'    c           	         [         R                  " U R                  5       5      nUR                  R                  nUR                  R
                  R                  nU R                  R                  XR                  5      nUR                  nUR                  U" S0 UR                  5       D65      nUR                  nUR                  n	[        R                   " Xy5      n
["        R$                  " XU
5      nU
R&                  R)                  U5        UR+                  UR-                  UR.                  UR0                  UR3                  5       US95      n[        R4                  R7                  UR8                  SUR.                  UR0                  S.S9nUR:                  (       a(  [<        R>                  " USRA                  X5      SSS9  U$ UR                  R7                  UR3                  5       S	UR.                  UR0                  S.S9n[B        RD                  " XN5      n[F        RH                  " XS
RA                  X5      5      $ )N)projectregionrouterrouterResourcezcompute.regionOperations)r,   r-   )
collectionparamszRule [{0}] in NAT [{1}]Tz[Run the [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetailszcompute.routersz Creating Rule [{0}] in NAT [{1}] )%r   ComputeApiHolderReleaseTrackclientmessagesapitools_clientroutersr   ResolveAsResourcer   ComputeRoutersGetRequestGetAsDictrule_numbernatr   FindNatOrRaiser   CreateRuleMessagerulesappendPatchComputeRoutersPatchRequestr,   r-   NameREGISTRYParsenameasync_r   CreatedResourceformatr   Pollerr   WaitFor)selfargsholderr9   service
router_refrequest_typer.   r@   nat_nameexisting_natruleresultoperation_reftarget_router_refoperation_pollers                   r'   Run
Create.Run5   s   **4+<+<+>?F}}%%Hmm++33G2249I9IJJ44L[[<
(9(9(;<=F""KxxH,,V>L((|DDd#]]++&&$$??$!	 	, 	#$F &&,,-!)) ''
 - M {{	
(//F3	4 m((..$!)) ''
 /  }}W@>>*11+HJ Jr*   r5   N)	__name__
__module____qualname____firstlineno____doc__classmethodr(   r^   __static_attributes__r5   r*   r'   r   r   !   s     ,( (5Jr*   r   zO
        *{command}* is used to create a Rule on a Compute Engine NAT.
        a<          Create a rule to use the IP Address address-1 to talk to destination IPs
        in the CIDR Range "203.0.113.0/24".

          $ {command} 1 --nat=my-nat --router=my-router --region=us-central1
            --match='inIpRange(destination.ip, "203.0.113.0/24")'
            --source-nat-active-ips=a1
        )DESCRIPTIONEXAMPLESN)"rd   
__future__r   r   r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r   *googlecloudsdk.command_lib.compute.routersr   /googlecloudsdk.command_lib.compute.routers.natsr   5googlecloudsdk.command_lib.compute.routers.nats.rulesr   r   googlecloudsdk.corer   r   ReleaseTracksr7   ALPHABETAGACreateCommandr   detailed_helpr5   r*   r'   <module>ry      s    9 &  ' 7 < . ( E M F V M # ) T..33T5F5F5I5IFJT FJFJV		 r*   