
                         j   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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 operations list' command.    )absolute_import)division)unicode_literals)util)arg_parsers)base)log)resource_projectorc                   4    \ rS rSrSr\S 5       rS rS rSr	g)List   zList long running operations.c           	      B   U R                  SSSS9  U R                  SS[        R                  " SSS9S9  U R                  S	[        S
S9  [        R
                  R                  U 5        [        R                  R                  U 5        [        R                  " U S5        g)z Register flags for this command.z
--locationTzLocation of the operations.)requiredhelpz--operation-filterz:Filter expression that specifies the operations to return.z'Not all operation types are supported.
)defaultuniverse_helpz--page-tokenzHThe next_page_token value returned from a previous List request, if any.)typer   zoperations to listN)
add_argumentr   UniverseHelpTextstrr   URI_FLAGRemoveFromParserFILTER_FLAGr   AddParentArgs)parsers    &lib/surface/logging/operations/list.pyArgs	List.Args#   s     t*G  I
))LD	
  	 	   	MM""6*%%f-v34    c              #   v  #    [         R                  " [         R                  " U5      SUR                  5      n[         R                  " 5       R                  UUR                  UR                  UR                  S9n[         R                  " 5       R                  R                  U5      nSU l        UR                   HW  nUv   U R                  (       a  M  [        R                  " U5      nUR!                  S0 5      R!                  SS5      U l        MY     UR"                  (       a  UR"                  v   gg7f)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.

Yields:
  A list of operations.
	locations)namefilterpageSize	pageTokenFmetadatacancellationRequested N)r   CreateResourceNameGetParentFromArgslocationGetMessages-LoggingProjectsLocationsOperationsListRequestoperation_filter	page_size
page_token	GetClientprojects_locations_operationsr   _cancellation_requested
operationsr
   MakeSerializablegetnextPageToken)selfargsoperation_namerequestresult	operationserialize_ops          r   RunList.Run?   s     ,,t$k4==BN  NN$$//	 O G ^^;;@@IF#(D &&	o))))::9E'3'7'7
B'G'K'K#R()$	 '     s   CD9A"D9c                 f    U R                   (       a   [        R                  R                  S5        g g )NzzNote: Cancellation happens asynchronously. It may take up to 10 minutes for the operation's status to change to cancelled.)r3   r	   statusPrint)r8   resources_were_displayeds     r   EpilogList.Epilog^   s)    ##	jjGH $r   )r3   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r?   rE   __static_attributes__ r   r   r   r      s$    
 &5 56!>Hr   r   a+  
        Return a list of long running operations in the given LOCATION. The
        operations were scheduled by other gcloud commands.

        For example, a CopyLogEntries operation may be scheduled by the command:
        `gcloud logging copy BUCKET_ID DESTINATION --location=LOCATION`.

        The `--operation-filter` flag is required and must specify the
        `request_type`. Supported request types include but are not limited to:
        `CopyLogEntries`, `CreateBucket` and `UpdateBucket`.

        Additional supported filter expressions include: `operation_start_time`,
        `operation_finish_time` and `operation_state`. These can be combined
        with the case-sensitive keyword `AND` between them.

        For `operation_start_time` and `operation_end_time`, the operators >=,
        >, <=, and < are supported.

        Timestamps must be in either RFC3339 or ISO8601 formats. If the
        timestamp contains a time value, then it must be quoted. For examples:
        "YYYY-MM-DDTHH:MM:SSZ", "YYYY-MM-DDTHH:MM:SS.mmmZ", "YY-MM-DD",
        "YYYY-MM-DDTHH:MM:SS-0000", "YYYY-MM-DDTHH:MM+0000", "YYYY-MM-DD",
        YYYY-MM-DD, YY-MM-DD, etc.

        The `operation_state` filter expression can be used to filter for
        operations that are in a specific state. The value can be one of the
        following: `SCHEDULED`, `WAITING_FOR_PRECONDITIONS`, `RUNNING`,
        `SUCCESS`, `FAILURE`, `CANCELLED`, `PENDING`.

        For `operation_state`, the operators = and != are supported.

        Other filter options are not supported.
        a          To list CopyLogEntries operations, run:

            $ {command} --location=LOCATION --operation-filter='request_type=CopyLogEntries'

        To list CopyLogEntries operations that started after a specified time, run:

            $ {command} --location=LOCATION --operation-filter='request_type=CopyLogEntries AND operation_start_time>="2023-11-20T00:00:00Z"'

        To list CopyLogEntries operations that finished before a specified time, run:

            $ {command} --location=LOCATION --operation-filter='request_type=CopyLogEntries AND operation_finish_time<="2023-11-20T00:00:00Z"'

        To list CopyLogEntries operations that completed successfully, run:

            $ {command} --location=LOCATION --operation-filter='request_type=CopyLogEntries AND operation_state=SUCCESS'

        To list CopyLogEntries operations that have not failed, run:

            $ {command} --location=LOCATION --operation-filter='request_type=CopyLogEntries AND operation_state!=FAILURE'
        )DESCRIPTIONEXAMPLESN)rK   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   r   googlecloudsdk.corer	   googlecloudsdk.core.resourcer
   UniverseCompatibleReleaseTracksReleaseTrackGABETAALPHAListCommandr   detailed_helprN   r   r   <module>r^      s    ) &  ' / / ( # ; $++00$2C2C2I2IBH4 BH BHL BE7 r   