
                          z   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 rS rS rS rS rS rS r\
R4                  " \
R6                  R8                  \
R6                  R:                  \
R6                  R<                  5       " S S\
R>                  5      5       r g)z3Command for removing a path matcher from a URL map.    )absolute_import)division)unicode_literals)encoding)base_classes)base)
exceptions)scope)flags)url_maps_utilsc                      SSSS.$ )N%Remove a path matcher from a URL map.z
*{command}* is used to remove a path matcher from a URL
map. When a path matcher is removed, all host rules that
refer to the path matcher are also removed.
z
To remove the path matcher named ``MY-MATCHER'' from the URL map named
``MY-URL-MAP'', you can use this command:

  $ {command} MY-URL-MAP --path-matcher-name=MY-MATCHER
)briefDESCRIPTIONEXAMPLES r       3lib/surface/compute/url_maps/remove_path_matcher.py_DetailedHelpr       s     2

 r   c                     U R                   R                  SU R                  R                  UR	                  5       UR
                  S94$ )z6Returns the request for the existing URL map resource.Get)urlMapproject)apitools_clienturlMapsmessagesComputeUrlMapsGetRequestNamer   clienturl_map_refs     r   _GetGetRequestr"   2   sK    

 
 
(
(%
//
2
2 %%'1D1D 3 F
G Gr   c                     U R                   R                  SU R                  R                  UR	                  5       UUR
                  S94$ )NUpdate)r   urlMapResourcer   )r   r   r   ComputeUrlMapsUpdateRequestr   r   r    r!   replacements      r   _GetSetRequestr)   9   sL    

 
 
(
((
//
5
5 %%'(!)) 6 +
, ,r   c                    [         R                  " U5      n/ nSnUR                   H2  nUR                  U R                  :X  a  SnM!  UR                  U5        M4     U(       d/  [        R                  " SR                  U R                  5      5      eX2l        / nUR                   H0  nUR                  U R                  :w  d  M  UR                  U5        M2     Xbl	        U$ )z#Returns a modified URL map message.FTz.No path matcher with the name [{0}] was found.)r   CopyProtoMessagepathMatchersnamepath_matcher_nameappendcompute_exceptionsArgumentErrorformat	hostRulespathMatcher)argsexistingr(   new_path_matcherspath_matcher_foundpath_matchernew_host_rules	host_rules           r   _Modifyr<   A   s    ))(3+ ++lD222|,	 , 


*
*8??""	$% % / .%%i 6 66I& & )	r   c                     U R                   R                  SU R                  R                  UR	                  5       UR
                  UR                  S94$ )zAReturns the request to get an existing regional URL map resource.r   )r   r   region)r   regionUrlMapsr   ComputeRegionUrlMapsGetRequestr   r   r>   r   s     r   _GetRegionalGetRequestrA   _   sR    

 
 
.
.
//
8
8 %%'!)) '' 9 )
* *r   c           	          U R                   R                  SU R                  R                  UR	                  5       UUR
                  UR                  S94$ )zDReturns the request to update an existing regional URL map resource.r$   )r   r%   r   r>   )r   r?   r   !ComputeRegionUrlMapsUpdateRequestr   r   r>   r'   s      r   _GetRegionalSetRequestrD   h   sU    

 
 
.
.
//
;
; %%'(!)) ''	 < )
* *r   c                    UR                   nUR                  XR                  [        R                  R
                  S9n[        R                  " U5      (       a  [        X45      nO[        X45      nUR                  U/5      S   n[        X5      n[        R                  " U5      (       a  [        X4U5      nO[        X4U5      nUR                  U/5      $ )z=Issues requests necessary to remove path matcher on URL maps.)default_scoper   )r    ResolveAsResource	resourcescompute_scope	ScopeEnumGLOBALr   IsRegionalUrlMapRefrA   r"   MakeRequestsr<   rD   r)   )	r5   holderurl_map_argr    r!   get_requesturl_mapmodified_url_mapset_requests	            r   _RunrT   r   s    ==&--
M,C,C,J,J . L+''44(=K 5K.q1'T+''44(>NOK 6FGK			k]	++r   c                   @    \ rS rSrSr\" 5       rSr\S 5       r	S r
Srg)RemovePathMatcher   r   Nc                     [         R                  " 5       U l        U R                  R                  U5        UR	                  SSSS9  g )Nz--path-matcher-nameTz'The name of the path matcher to remove.)requiredhelp)r   UrlMapArgumentURL_MAP_ARGAddArgumentadd_argument)clsparsers     r   ArgsRemovePathMatcher.Args   s@    **,COOO'
6  8r   c                 v    [         R                  " U R                  5       5      n[        XU R                  5      $ )N)r   ComputeApiHolderReleaseTrackrT   r\   )selfr5   rN   s      r   RunRemovePathMatcher.Run   s.    **4+<+<+>?Fd..//r   r   )__name__
__module____qualname____firstlineno____doc__r   detailed_helpr\   classmethodra   rg   __static_attributes__r   r   r   rV   rV      s*     ./-+8 80r   rV   N)!rm   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r0   r
   rI   +googlecloudsdk.command_lib.compute.url_mapsr   r   r   r"   r)   r<   rA   rD   rT   ReleaseTracksre   ALPHABETAGAUpdateCommandrV   r   r   r   <module>r|      s     : &  ' % 7 ( O E = F$G,<**,, D%%++T->->-C-C%%((*0** 0*0r   