
                         R   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
  \R                  \R                  " \R                  R                  \R                  R                  \R                  R                   5       " S S	\R"                  5      5       5       rS
SS.\l        g)z'logging copy' command.    )absolute_import)division)unicode_literals)util)base)
console_ioc                   4    \ rS rSrSr\S 5       rS rS rSr	g)Copy   zCopy log entries.c                     U R                  SSS9  U R                  SSS9  U R                  SSSS	9  U R                  S
SSS	9  [        R                  " U S5        g)z Register flags for this command.	bucket_idz:Id of the log bucket to copy logs from. Example: my-bucket)helpdestinationzjDestination to copy logs to. Example: Cloud Storage bucket: storage.googleapis.com/my-cloud-storage-bucketz
--locationTzLocation of the log bucket.)requiredr   z--log-filterFzA filter specifying which log entries to copy. The filter must be no more than 20k characters. An empty filter matches all log entries.zlog entries to copyN)add_argumentr   AddParentArgs)parsers    lib/surface/logging/copy.pyArgs	Copy.Args!   s     I   >   t*G   7	   	v45    c                    UR                   (       d  [        R                  " SSS9  [        R                  " [        R                  " [        R
                  " U5      SUR                  5      SUR                  5      n[        R                  " 5       R                  UR                  UR                   US9n[        R                  " 5       R                  R                  U5      $ )Nz(An empty filter matches all log entries.T)cancel_on_no	locationsbuckets)r   filtername)
log_filterr   PromptContinuer   CreateResourceNameGetParentFromArgslocationr   GetMessagesCopyLogEntriesRequestr   	GetCliententriesr
   )selfargsparent_namerequests       r   _Run	Copy._Run>   s    ??
44I ))""4(+t}}	F4>>#K  66$$T__; 7 PG >>##((11r   c                 $    U R                  U5      $ )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:
  A copy_log_entries operation.

)r+   )r'   r(   s     r   RunCopy.RunL   s     99T?r    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r+   r.   __static_attributes__r0   r   r   r
   r
      s#    
 6 682r   r
   za        {command} starts the process to copy log entries from a log bucket to a destination.
    aN          To start a copy log entries operation, run:

          $ {command} BUCKET_ID DESTINATION --location=LOCATION

        To copy log entries in a specific time window, run:

          $ {command} BUCKET_ID DESTINATION --location=LOCATION --log-filter='timestamp<="2021-05-31T23:59:59Z" AND timestamp>="2021-05-31T00:00:00Z"'
    )DESCRIPTIONEXAMPLESN)r5   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   googlecloudsdk.core.consoler   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHABETAGACommandr
   detailed_helpr0   r   r   <module>rF      s     &  ' / ( 2 T..33T5F5F5I5I94<< 9 9z		 r   