
                             S r SSKJr  SSKJr  SSKJr  SSK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r " S S\R"                  5      rg)zAA command that parses resources given collection and api version.    )absolute_import)division)unicode_literalsN)base)
exceptions)log)	resources)
console_io)resource_printerc                   8    \ rS rSrSr\S 5       rS rSS jrSr	g)	Parse"   zzCloud SDK resource parser module tester.

*{command}* is an handy way to debug the resource parser from the command
line.
c                     U R                  SSSS9  U R                  SSSS9  U R                  SS	S
SS9  U R                  SSSS9  g )Nz--api-versionVERSIONzUThe resource collection API version. The collection default is used if not specified.)metavarhelpz--collectionNAMEz6The resource collection name of the resource to parse.z--stack-trace
store_trueTzGEnable all exception stack traces, including Cloud SDK core exceptions.)actiondefaultr   resources_to_parse*z~The list of resource URLs to parse. If not specified then *{command}* enters an interactive loop, prompting for URLs to parse.)nargsr   )add_argument)parsers    #lib/surface/meta/resources/parse.pyArgs
Parse.Args)   s    
*  ,
 E  G 	         c           	      H   UR                   (       aE  UR                  R                  S5      S   n[        R                  R                  X!R                   S9  UR                  (       a  / nUR                   H  n [        R                  R                  XAR                  S9nUR%                  5       nUR#                  UR&                  UR                   UR(                  UR+                  5       UR-                  5       S.5        M     U$  [.        R0                  " S5      nUc  OYU(       d  M$   [        R                  R                  UUR                  S9R+                  5       n[2        R4                  " US	5        Ms  [6        R8                  R;                  S
5        g! [        [        4 a  nUR                  (       a  [        R                  " U5        [        R                  " [        R                   " U5      5        UR#                  [        R                   " U5      US.5         SnAGM  SnAff = f! [        [        4 a]  nUR                  (       a  [        R                  " U5        [        R                  " [        R                   " U5      5         SnAGM  SnAff = f)z/Returns the parsed parameters for one resource..r   )api_version)
collection)erroruriN)api_namer"   r#   paramsr%   zPARSE> json
)r"   r#   splitr	   REGISTRYRegisterApiByNamer   r   	Exception
SystemExitstack_tracer   reraiser   r$   six	text_typeappendGetCollectionInfor&   	full_nameAsDictSelfLinkr
   PromptResponser   Printsysstderrwrite)	selfargsr&   parsed_resourcesr%   resourceecollection_infor'   s	            r   Run	Parse.RunA   s   &&s+A.h**
 0 0 + 2 ((#
	''--coo-N( #446'00*66)33oo'$$&!
 	 )( 
%%i0c	##)) * ((. 	 VV,   JJTI :& 	q!
))CMM!$
%

!
!}}Q'#  	: $ 


Q
		#--"#	s2   :'F-6H4 H1,A9H,,H14J!AJJ!c                     Ag )N )r=   items_were_listeds     r   EpilogParse.Epilogs   s    r   rF   N)F)
__name__
__module____qualname____firstlineno____doc__staticmethodr   rC   rH   __static_attributes__rF   r   r   r   r   "   s&      .0dr   r   )rN   
__future__r   r   r   r:   googlecloudsdk.callioper   googlecloudsdk.corer   r   r	   googlecloudsdk.core.consoler
   googlecloudsdk.core.resourcer   r1   ListCommandr   rF   r   r   <module>rW      s@     H &  ' 
 ( * # ) 2 9 
RD Rr   