
    d                        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dlmZ e
j"                   e
j$                  e
j&                  j(                         G d de
j*                                      Z e
j$                  e
j&                  j.                         G d de             Z e
j$                  e
j&                  j2                         G d de             Zy)zStream-logs command.    )absolute_import)division)unicode_literals)cloudbuild_util)logs)base)flags)log)
properties)	resourcesc                   4    e Zd ZdZdddZdZed        Zd Zy)LogStream the logs for a build.z
            To stream logs for in progress build `123-456-789`:

                $ {command} --stream `123-456-789`

            To display logs for a completed build `098-765-432`:

                $ {command} `098-765-432`
            )DESCRIPTIONEXAMPLESFc                     t        j                  |        t        j                  | d       | j                  ddd       y )Nz&The build whose logs shall be printed.)introz--streamzKIf a build is ongoing, stream the logs to stdout until the build completes.
store_true)helpaction)r	   AddRegionFlagAddBuildArgadd_argument)parsers    lib/surface/builds/log.pyArgszLog.Args1   s?    		f$LM
%	      c                    |j                   xsD t        j                  j                  j                   j	                         xs t
        j                  }t        j                         }t        j                         }t        j                  j                  |j                  t        j                  j                  j                  j                  |dd      }t!        j"                  ||| j$                        }|j&                  r=| j$                  st(        j*                  j-                  d       |j/                  |       y|j1                  |       y)zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    )
projectsIdlocationsIdz$cloudbuild.projects.locations.builds)params
collectionz
gcloud builds log --stream only displays logs from Cloud Storage. To view logs from Cloud Logging, run:
gcloud beta builds log --stream
N)regionr   VALUESbuildsGetr   DEFAULT_REGIONGetClientInstanceGetMessagesModuler   REGISTRYParsebuildcoreproject	GetOrFailcb_logsCloudBuildClient_support_gclstreamr
   statusPrintStreamPrintLog)selfargsbuild_regionclientmessages	build_refloggers          r   RunzLog.Run;   s    	 	*##**..0	*))  ..0F002H""((

$++0088BB'
 : ) ;I %%fh8I8IJF{{

%	& mmI OOIr   N)	__name__
__module____qualname____doc__detailed_helpr2   staticmethodr   r?    r   r   r   r      s4     %3- , &r   r   c                       e Zd ZdZdZy)LogBetar   TNr@   rA   rB   rC   r2   rF   r   r   rH   rH   d   
    $,r   rH   c                       e Zd ZdZdZy)LogAlphar   TNrI   rF   r   r   rL   rL   k   rJ   r   rL   N)rC   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   r   r0   googlecloudsdk.callioper   !googlecloudsdk.command_lib.buildsr	   googlecloudsdk.corer
   r   r   UniverseCompatibleReleaseTracksReleaseTrackGACommandr   BETArH   ALPHArL   rF   r   r   <module>rY      s     &  ' = = ( 3 # * ) D%%(()A$,, A * AH D%%**+c  , D%%++,w  -r   