
    F                     V   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 rS rS rS r\
R2                  \
R4                  " \
R6                  R8                  5       " S S\
R:                  5      5       5       r\
R2                  \
R4                  " \
R6                  R>                  5       " S S\5      5       5       r \
R2                  \
R4                  " \
R6                  RB                  5       " S S\ 5      5       5       r"g)zCommand for cache invalidation.    )absolute_import)division)unicode_literals)base_classes)batch_helper)utils)base)
exceptions)scope)flags)url_maps_utils)logc                      SSS.$ )N?Invalidate specified objects for a URL map in Cloud CDN caches.z      *{command}* requests that Cloud CDN stop using cached content for
      resources at a particular URL path or set of URL paths.

      *{command}* may succeed even if no content is cached for some or all
      URLs with the given path.
      )briefDESCRIPTION r       4lib/surface/compute/url_maps/invalidate_cdn_cache.py_DetailedHelpr       s     L
	
 r   c                     U R                  SSSS9  U R                  SSSSS9  U R                  S	SSS
S9  [        R                  R                  U 5        g)z1Add invalidate-cdn-cache arguments to the parser.z--pathFa        A path specifying which objects to invalidate. PATH must start with
      ``/'' and the only place a ``*'' is allowed is at the end following a
      ``/''. It will be matched against URL paths, which do not include
      scheme, host, or any text after the first ``?'' or ``#'' (and those
      characters are not allowed here). For example, for the URL
      ``https://example.com/whatever/x.html?a=b'', the path is
      ``/whatever/x.html''.

      If PATH ends with ``*'', the preceding string is a prefix, and all URLs
      whose paths begin with it will be invalidated. If PATH doesn't end with
      ``*'', then only URLs with exactly that path will be invalidated.

      Examples:
      - ``'', ``*'', anything that doesn't start with ``/'': error
      - ``/'': just the root URL
      - ``/*'': everything
      - ``/x/y'': ``/x/y'' only (and not ``/x/y/'')
      - ``/x/y/'': ``/x/y/'' only (and not ``/x/y'')
      - ``/x/y/*'': ``/x/y/'' and everything under it
      )requiredhelpz--hostNz_      If set, this invalidation will apply only to requests to the
      specified host.
      )r   defaultr   z--tagsz      A single tag or a comma-delimited list of tags. When multiple tags are
      specified, the invalidation applies them using boolean OR logic.

      Example:
      - ``--tags=abcd,user123''
      )add_argumentr	   
ASYNC_FLAGAddToParser)parsers    r   _Argsr   /   s|     	
  2 	
	   	
	  
 //f%r   c                    UR                  XR                  [        R                  R                  S9n[
        R                  " U5      (       a  [        R                  " S5      eU R                  R                  R                  UR                  S9nUR                  b  UR                  Ul        [        US5      (       a_  UR                  bR  UR                   R#                  UR                  R%                  S5       Vs/ s H  oUR'                  5       PM     sn5        U R                  R                  nUR)                  UR*                  UR-                  5       US9nU R                  R.                  R0                  nUSU4/$ s  snf )z=Returns a list of requests necessary for cache invalidations.)default_scopezLInvalid flag [--region]: Regional URL maps do not support Cloud CDN caching.)pathtags,)projecturlMapcacheInvalidationRuleInvalidateCache)ResolveAsResource	resourcescompute_scope	ScopeEnumGLOBALr   IsRegionalUrlMapRefcompute_exceptionsArgumentErrorclientmessagesCacheInvalidationRuler"   hosthasattrr#   	cacheTagsextendsplitstrip$ComputeUrlMapsInvalidateCacheRequestr%   Nameapitools_clienturlMaps)	holderargsurl_map_argurl_map_refcache_invalidation_ruletagr2   request
collections	            r   _CreateRequestsrF   c   sS   --
M,C,C,J,J . L+''44

*
*	? 
 #MM22HH99 I 	YY#'99 T6tyy4%%,, $		 45 4 457 ]]##(99!!3 : 5' }},,44*('
2	33 	6s   ?Fc                    UR                   n[        XU5      nU R                  (       a  [        R                  " UUR
                  R                  UR                  S9u  pVU(       d{  U Hs  n[        R                  R                  SR                  UR                  5      5        [        R                  R                  SR                  UR                  5      5        Mu     U$ [        R                  " U5         U$ UR	                  U5      nU$ )z<Issues requests necessary to invalidate a URL map cdn cache.)requestshttp	batch_urlzInvalidation pending for [{0}]
zMonitor its progress at [{0}]
)r1   rF   async_r   MakeRequestsr<   rI   rJ   r   statuswriteformat
targetLinkselfLinkr   RaiseToolException)r?   r>   r@   r1   rH   r*   errorsinvalidation_operations           r   _RunrU      s    ==&V;7(	[[$11##((""$I $-
 

;BB"--/ 	0

:AA"++- 	. %. 
 v& 
 ##H-I	r   c                   @    \ rS rSrSr\" 5       rSr\S 5       r	S r
Srg)InvalidateCdnCache   r   Nc                     [         R                  " 5       U l        U R                  R                  USS9  [	        U5        g )NURLMAP)cust_metavar)r   GlobalUrlMapArgumentURL_MAP_ARGAddArgumentr   )clsr   s     r   ArgsInvalidateCdnCache.Args   s0    002COOOX>	&Mr   c                 v    [         R                  " U R                  5       5      n[        XU R                  5      $ )N)r   ComputeApiHolderReleaseTrackrU   r]   )selfr?   r>   s      r   RunInvalidateCdnCache.Run   s.    **4+<+<+>?Fd..//r   r   )__name__
__module____qualname____firstlineno____doc__r   detailed_helpr]   classmethodr`   rf   __static_attributes__r   r   r   rW   rW      s+     H/-+ 
0r   rW   c                       \ rS rSrSrg)InvalidateCdnCacheBeta   r   Nrh   ri   rj   rk   ro   r   r   r   rq   rq           r   rq   c                       \ rS rSrSrg)InvalidateCdnCacheAlpha   r   Nrs   r   r   r   rv   rv      rt   r   rv   N)#rl   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r/   r   r+   +googlecloudsdk.command_lib.compute.url_mapsr   r   googlecloudsdk.corer   r   r   rF   rU   DefaultUniverseOnlyReleaseTracksrd   GASilentCommandrW   BETArq   ALPHArv   r   r   r   <module>r      s   & &  ' 7 7 0 ( O E = F #1&h4:4 D%%(()0++ 0 * 0" D%%**+/  ,  D%%++,4  - r   