
                             d 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 dd
lmZ d Z ej                   ej"                  j$                         G d dej&                               Zy)zDA command that prints out information about your gcloud environment.    )absolute_import)division)unicode_literals)base)info_holder)
exceptions)log)network_diagnostics)property_diagnosticsc                     t        j                         j                         }t        j                  |       j                         }|xr |S )N)r
   NetworkDiagnostic	RunChecksr   PropertyDiagnostic) ignore_hidden_property_allowlistpassed_networkpassed_propss      lib/surface/info.py_RunDiagnosticsr      sA    &88:DDF.%88&((1	 		(L(    c                   L    e Zd ZdZddiZej                  Zed        Z	d Z
d Zy)Infoz9Display information about the current gcloud environment.EXAMPLESa  
          To display information about the current gcloud environment including
          the Google Cloud account, project and directory paths for
          logs, run:

            $ {command}

          To check network connectivity and hidden properties, run:

            $ {command} --run-diagnostics

          To print the contents of the most recent log file, run:

            $ {command} --show-log
          c                     | j                  d      }|j                  ddd       |j                         }|j                  ddd       |j                  d	ddd
       | j                  ddd       y )NT)mutexz
--show-log
store_truez(Print the contents of the last log file.)actionhelpz--run-diagnosticsz=Run diagnostics on your installation of the Google Cloud CLI.z"--ignore-hidden-property-allowlistz%Ignore the hidden property allowlist.)r   hiddenr   z--anonymizezWMinimize any personal identifiable information. Use it when sharing output with others.)	add_groupadd_argument)parsermodediagnosticss      r   Argsz	Info.Args>   s    $'D7  9 .."KL  N ,4	  6
 7  8r   c                     |j                   r-t        |j                        }|ry t        j                  d      t        j                  |j                  rt        j                               S d       S )Nz)Some of the checks in diagnostics failed.)
anonymizer)	run_diagnosticsr   r   r   Errorr   
InfoHolder	anonymize
Anonymizer)selfargspasseds      r   RunzInfo.RunU   si    tDDEf	JKK!!/3~~;))+I ICGI Ir   c                    |sy |j                   st        j                  |       y |j                  j                  rRt        j                  dj                  |j                  j                  |j                  j                                      y y )Nz]
Contents of log file: [{0}]
==========================================================
{1}

)show_logr	   Printlogslast_logformatLastLogContents)r,   r-   infos      r   DisplayzInfo.Display_   sc    ==	iio				ii  		**DII,E,E,GHJ 
r   N)__name__
__module____qualname____doc__detailed_helpr   SDK_TOOLS_CATEGORYcategorystaticmethodr$   r/   r8    r   r   r   r   &   sA    A  -$ $$(8 8,I	Jr   r   N)r<   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_libr   googlecloudsdk.corer   r	   googlecloudsdk.core.diagnosticsr
   r   r   ReleaseTracksReleaseTrackGACommandr   rA   r   r   <module>rK      sk     K &  ' ) 2 * # ? @) D%%(()AJ4<< AJ *AJr   