
    p                        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mZ dd
lmZ ddlmZ ddlmZ ej0                   ej2                  ej4                  j6                  ej4                  j8                  ej4                  j:                         G d dej<                                      Zdddde_         y)z6Command for updating a NAT on a Compute Engine router.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)flags)
nats_utils)log)	resourcesc                   &    e Zd ZdZed        Zd Zy)Updatez(Update a NAT on a Compute Engine router.c                 6   t        j                         | _        | j                  j                  |       t        j
                  j                  |       t        j                  |dd       t        j                  |d       t        j                  |d       y )NNATcreate)operation_typeF)
for_create)routers_flagsRouterArgumentForNat
ROUTER_ARGAddArgumentr	   
ASYNC_FLAGAddToParsercompute_flagsAddRegionFlag
nats_flagsAddNatNameArgAddCommonNatArgs)clsparsers     *lib/surface/compute/routers/nats/update.pyArgszUpdate.Args(   sh    "779CNNNv&OO'hGVH=59    c           	         t        j                  | j                               }|j                  j                  }|j                  j
                  j                  }| j                  j                  ||j                        }|j                  }|j                   |di |j                               }t        j                  ||j                        }t        j                   |||      }	|j"                  }|j%                   ||j&                  |j(                  |j+                         |            }
t        j,                  j/                  |
j                  d|j&                  |j(                  d      }|j0                  rCt3        j4                  |dj7                  |	j                  |j+                               dd       |
S |j                  j/                  |j+                         d	|j&                  |j(                  d      }t9        j:                  ||      }t=        j>                  ||d
j7                  |	j                  |j+                                     S )N)projectregionrouterrouterResourcezcompute.regionOperations)r&   r'   )
collectionparamsznat [{0}] in router [{1}]Tz[Run the [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetailszcompute.routersz"Updating nat [{0}] in router [{1}] ) r   ComputeApiHolderReleaseTrackclientmessagesapitools_clientroutersr   ResolveAsResourcer   ComputeRoutersGetRequestGetAsDictr   FindNatOrRaisenameUpdateNatMessageComputeRoutersPatchRequestPatchr&   r'   NameREGISTRYParseasync_r   UpdatedResourceformatr   Pollerr   WaitFor)selfargsholderr3   service
router_refrequest_typereplacementexisting_natnatresultoperation_reftarget_router_refoperation_pollers                 r"   Runz
Update.Run4   s   **4+<+<+>?F}}%%Hmm++33G2249I9IJJ44L++lAZ->->-@ABK ,,[$))DL

%
%lD&
AC66L]]&&$$??$&		()F &&,,-!)) ''
 - M {{	
*11#((JOO<MN3	4 m((..$!)) ''
 /  }}W.?@>>-,33CHH4>OO4E	GH Hr$   N)__name__
__module____qualname____doc__classmethodr#   rT   r/   r$   r"   r   r   !   s    
 1	: 	:3Hr$   r   zQ
        *{command}* is used to update a NAT in a Compute Engine router.
        a          Change subnetworks and IP address resources associated with NAT:

          $ {command} nat1 --router=my-router
            --nat-external-ip-pool=ip-address2,ip-address3
            --nat-custom-subnet-ip-ranges=subnet-2,subnet-3:secondary-range-2

        Change minimum default ports allocated per VM associated with NAT:

          $ {command} nat1 --router=my-router --min-ports-per-vm=128

        Change connection timeouts associated with NAT:

          $ {command} nat1 --router=my-router
            --udp-idle-timeout=60s
            --icmp-idle-timeout=60s
            --tcp-established-idle-timeout=60s
            --tcp-transitory-idle-timeout=60s

        Reset connection timeouts associated NAT to default values:

          $ {command} nat1 --router=my-router
            --clear-udp-idle-timeout --clear-icmp-idle-timeout
            --clear-tcp-established-idle-timeout
            --clear-tcp-transitory-idle-timeout
        a      This command, when specified without alpha or beta, uses the compute/v1/routers API. The full documentation
    for this API can be found at: https://cloud.google.com/compute/docs/reference/rest/v1/routers/

    The beta command uses the compute/beta/routers API. The full documentation
    for this API can be found at: https://cloud.google.com/compute/docs/reference/rest/beta/routers/

    The alpha command uses the compute/alpha/routers API. Full documentation is not available for the alpha API.
    )DESCRIPTIONEXAMPLESzAPI REFERENCEN)!rX   
__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   r   googlecloudsdk.corer   r   UniverseCompatibleReleaseTracksr1   ALPHABETAGAUpdateCommandr   detailed_helpr/   r$   r"   <module>rl      s    = &  ' 7 < . ( E M O F # ) T..33T5F5F5I5IBHT BH BHL4=' r$   