
    	                         S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKJr  SSKJ	r	  SSK
Jr   " S	 S
\R                  5      rg)z,A command that reads JSON data and lists it.    )absolute_import)division)unicode_literalsN)base)
exceptions)filesc                   .    \ rS rSrSr\S 5       rS rSrg)ListFromJson   a  Read JSON data and list it on the standard output.

*{command}* is a test harness for resource output formatting and filtering.
It behaves like any other `gcloud ... list` command except that the resources
are read from a JSON data file.

The input JSON data is either a single resource object or a list of resource
objects of the same type. The resources are printed on the standard output.
The default output format is *json*.
c                     [         R                  R                  U 5        U R                  SSSS SS9  U R                  R                  S5        U R                  R                  S 5        g )N	json_filez	JSON-FILE?zA file containing JSON data for a single resource or a list of resources of the same type. If omitted then the standard input is read.)metavarnargsdefaulthelpjson)r   URI_FLAGRemoveFromParseradd_argumentdisplay_info	AddFormatAddCacheUpdater)parsers    "lib/surface/meta/list_from_json.pyArgsListFromJson.Args*   sb    MM""6*
   !!&)
''-    c                    UR                   (       a7   [        R                  " [        R                  " UR                   5      5      nU$  [        R                  " [        R                  5      nU$ ! [        R
                  [        4 a5  n[        R                  " SR                  UR                   U5      5      eS nAff = f! [        [        4 a*  n[        R                  " SR                  U5      5      eS nAff = f)NzCannot read [{}]: {}z"Cannot read the standard input: {})r   r   loadsr   ReadFileContentsError
ValueErrorr   BadFileExceptionformatloadsysstdinIOError)selfargs	resourceses       r   RunListFromJson.Run8   s    ~~>JJu55dnnEF	 <IIcii(	  kk:& >))"))$..!<> 	>> z" <))077:< 	<<s/   4A0 
$C 0B?
0B::B?C<%C77C< N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r.   __static_attributes__r0   r   r   r
   r
      s     	 . .r   r
   )r5   
__future__r   r   r   r   r'   googlecloudsdk.callioper   r   googlecloudsdk.core.utilr   ListCommandr
   r0   r   r   <module>r<      s4     3 &  '  
 ( . *'4## 'r   