
    .                         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   " S
 S\	R                  5      rg)z-The gcloud datastore operations list command.    )absolute_import)division)unicode_literals)
operations)rewrite_backend)base)
properties)resource_projection_specc                   4    \ rS rSrSr\S 5       rS rS rSr	g)List   a  List pending Cloud Datastore admin operations and their status.

Filters are case-sensitive and have the following syntax:

  field = value [AND [field = value]] ...

where `field` is one of `kind`, `namespace`, `type`, or `labels.[KEY]`, and
`[KEY]` is a label key. `kind` and `namespace` may be `*` to query for
operations on all kinds and/or all namespaces. `type` may be one of
`export_entities` or `import_entities`.

Only the logical `AND` operator is
supported; space-separated items are treated as having an implicit `AND`
operator.

## EXAMPLES

To see the list of all operations, run:

  $ {command}

To see the list of all export operations, run:

  $ {command} --filter='type:export_entities'

To see the list of all export operations for kind 'MyKind', run:

  $ {command} --filter='type:export_entities AND kind:MyKind'

To see the list of all operations with particular labels, run:

  $ {command} --filter='labels.run = daily'
c                     [         R                  R                  U [        R                  5        [         R
                  R                  U [        R                  5        g)z Register flags for this command.N)r   PAGE_SIZE_FLAG
SetDefaultr   DEFAULT_PAGE_SIZE
LIMIT_FLAG)parsers    (lib/surface/datastore/operations/list.pyArgs	List.Args?   s:     	""6:+G+GHOOvz'C'CD    c                     U R                  UR                  U5      u  p#X!l        [        R                  " [        R
                  R                  R                  R                  SS9UR                  US9$ )NT)required)projectlimitoperation_filter)
_ConvertFilterfilterr   ListOperationsr	   VALUEScorer   Getr   )selfargsfrontend_filterbackend_filters       r   RunList.RunE   s`    &*&9&9$++t&L#O!K$$!!&&..22D2Ajj') )r   c                     [         R                  " 5       nUR                  5       n[        R                  " UR
                  UR                  S9nUR                  XS9$ )a8  Translates user-provided filter spec into one our backend understands.

Args:
  expression: a filter spec to translate
  args: the args namespace object
Returns:
  A tuple of string filter specs. The first is the frontend spec for post
  filtering, the second is a spec that the Datastore Admin API understands.
)symbolsaliases)defaults)r   OperationsRewriteBackendGetDisplayInfor
   ProjectionSpec
transformsr+   Rewrite)r#   
expressionr$   operation_rewrite_backenddisplay_infor,   s         r   r   List._ConvertFilterN   sW     !0 H H J&&(L'66''1E1EGH$,,Z,KKr    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r'   r   __static_attributes__r6   r   r   r   r      s)     D E E
)Lr   r   N)r;   
__future__r   r   r    googlecloudsdk.api_lib.datastorer   r   googlecloudsdk.callioper   googlecloudsdk.corer	   googlecloudsdk.core.resourcer
   ListCommandr   r6   r   r   <module>rD      s8    4 &  ' 7 < ( * A@L4 @Lr   