
                             d Z ddlmZ ddlmZ ddlmZ ddl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  G d dej*                        Z ej.                  d      ddde_        y)z8Command for removing a NAT from a Compute Engine router.    )absolute_import)division)unicode_literalsN)encoding)base_classes)utils)base)flags)
nats_utilsc                   6    e Zd ZdZdZed        Zd Zd Zd Z	y)AlphaDeletezhRemove a NAT from a Compute Engine router.

  *{command}* removes a NAT from a Compute Engine router.
  Nc                     t        j                         | _        | j                  j                  |       t	        j
                  |ddd       t        j                  |dd       y )NNATdeleteT)operation_typeplural)routers_flagsRouterArgumentForNat
ROUTER_ARGAddArgumentcompute_flagsAddRegionFlag
nats_flagsAddNatNameArg)clsparsers     *lib/surface/compute/routers/nats/delete.pyArgszAlphaDelete.Args(   sO    "779CNNNv&ht= VHTJ    c                     |j                   j                  d|j                  j                  |j	                         ||j
                  |j                        fS )NPatch)routerrouterResourceregionproject)apitools_clientroutersmessagesComputeRoutersPatchRequestNamer$   r%   )selfclient
router_refreplacements       r   _GetPatchRequestzAlphaDelete._GetPatchRequest2   sS    ""**GOO66!(*!(("**	 7 ,- -r   c                     t        j                  |      }|j                  D ]3  }t        j                  ||      }|j
                  j                  |       5 |j
                  s|j                  d       |S )zBMutate the router and record any cleared_fields for Patch request.nats)r   CopyProtoMessagenamer   FindNatOrRaiser1   removeappend)r+   argsexistingcleared_fieldsr.   r3   nats          r   ModifyzAlphaDelete.Modify:   se    ++H5K		%%k48cc" 
 F#r   c           
         t        j                  | j                               }|j                  }| j                  j                  ||j                        }|j                  |j                  j                  d |j                  j                  di |j                         fg      }g }| j                  ||d   |      }t        j                  ddj!                  |j"                  |j%                               g       |j                  j'                  |      5  |j                  | j)                  |||      g      }d d d        |S # 1 sw Y   S xY w)NGetr   r   z{} in router {} )r   ComputeApiHolderReleaseTrackr,   r   ResolveAsResource	resourcesMakeRequestsr&   r'   r(   ComputeRoutersGetRequestAsDictr;   r   PromptForDeletionHelperformatr3   r*   IncludeFieldsr/   )	r+   r7   holderr,   r-   objectsr9   
new_objectresults	            r   RunzAlphaDelete.RunH   s0   **4+<+<+>?F]]F2249I9IJJ!!

 
 
(
(%
2&//
2
2
IZ5F5F5H
I
K 	LMG
 NT71:~>J	!!!((JOO4EFGI 
			-	-n	=""  Z@
ACf 
> M	 
> Ms   $EE)
__name__
__module____qualname____doc__r   classmethodr   r/   r;   rM   r>   r   r   r   r       s1    
 *K K-r   r   zN          *{command}* is used to delete a NAT on a Compute Engine router.
    zg    To delete NAT 'n1' in router 'r1', run:

      $ {command} n1 --router=r1 --region=us-central1
    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 REFERENCE)rQ   
__future__r   r   r   textwrapapitools.base.pyr   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r   *googlecloudsdk.command_lib.compute.routersr   /googlecloudsdk.command_lib.compute.routers.natsr   r   DeleteCommandr   dedentdetailed_helpr>   r   r   <module>r`      sj    ? &  '  % 7 0 ( E M O F=$$$ =D 	  		 r   