
    p                     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	 r     SS jrg
)z0A library that contains common logging commands.    )absolute_import)division)unicode_literals)
list_pager)util)
exceptions)
propertiesc                     [        S Vs/ s H  nUR                  U5      PM     sn5      (       d  [        R                  " U SU-  5      eg s  snf )N)z	projects/zorganizations/zfolders/zbillingAccounts/zrInvalid resource %s. Resource must be in the form [projects|folders|organizations|billingAccounts]/{{resource_id}})any
startswithr   InvalidArgumentException)argresource_namets      ,lib/googlecloudsdk/api_lib/logging/common.py_AssertValidResourcer      se    	NN! q!N 
 
 
-
- K 	
 s   ANc           	          U=(       d    / nU H  n[        SU5        M     U(       a  [        SU5        UR                  U5        OJU(       dC  UR                  S[        R                  R                  R
                  R                  SS9-  5        [        U=(       d    SS5      nUR                  5       S:X  a  SnOS	n[        R                  " 5       nUR                  R                  X@US
9n[        R                  " UR                  USUUSS9$ )a  Fetches log entries.

This method uses Cloud Logging V2 api.
https://cloud.google.com/logging/docs/api/introduction_v2

Entries are sorted on the timestamp field, and afterwards filter is applied.
If limit is passed, returns only up to that many matching entries.

If neither log_filter nor log_ids are passed, no filtering is done.

FetchLogs will query the combined resource set from "parent" and
"resource_names".

Args:
  log_filter: filter expression used in the request.
  order_by: the sort order, either DESC or ASC.
  limit: how many entries to return.
  parent: the name of the log's parent resource, e.g. "projects/foo" or
    "organizations/123" or "folders/123". Defaults to the current project if
    no `resource_names` are provided.
  resource_names: if present, resource names to query.

Returns:
  A generator that returns matching log entries.
  Callers are responsible for handling any http exceptions.
resource_namesparentzprojects/%sT)requiredi  DESCztimestamp descztimestamp asc)resourceNamesfilterorderByentriespageSize)fieldlimit
batch_sizebatch_size_attribute)r   appendr	   VALUEScoreprojectGetminupperr   	GetClientMESSAGES_MODULEListLogEntriesRequestr   YieldFromListr   )	
log_filterorder_byr   r   r   name	page_sizeclientrequests	            r   	FetchLogsr2   (   s    > "'R.d)40  6*&!-$++0088<<d<KL M
 %-4&)^^HH>>&""88"x 9 I'		!	!nngYe
= =    )Nr   NNN)__doc__
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   googlecloudsdk.corer	   r   r2    r3   r   <module>r;      s:     7 &  ' ' / . * !	7=r3   