
                             S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  SS	K
Jr  \R                  " \R                  R                  5       " S
 S\R                   5      5       rg)z:Command to search folders associated with the active user.    )absolute_import)division)unicode_literalsN)
list_pager)folders)arg_parsers)basec                   2    \ rS rSrSrSr\S 5       rS rSr	g)Search   a  Search folders matching the specified query.

You can specify the maximum number of folders to return in the result
using the `--limit`flag.

## EXAMPLES

The following command lists the folders that have been marked for deletion:

  $ {command} --query='state:DELETE_REQUESTED'

Folders with their displayNames starting with sun like sunflower-folder,
sunburn-folder etc. can be listed using the below command

  $ {command} --query='displayName:sun*'

v3c           	      \   U R                   R                  S5        [        R                  R	                  U 5        [        R
                  R	                  U 5        U R                  SSS9  U R                  S[        R                  " S[        R                  SS9S	[        R                  S
S9  g )NzO
    table(
      displayName,
      name,
      parent,
      state
    )
    z--querya'            A boolean expression for the search criteria used to select the folders to return.
          If no search criteria is specified then all accessible projects will be returned.
          Query expressions can be used to restrict results based upon displayName, state
          and parent, where the operators `=` (`:`) `NOT`, `AND` and `OR` can be used along
          with the suffix wildcard symbol `*`. The `displayName` field in a query expression should
          use escaped quotes for values that include whitespace to prevent unexpected behavior.

          For more details and fields supported by the query expression please refer
          query parameters section `[here]
          (https://cloud.google.com/resource-manager/reference/rest/v3/folders/search#query-parameters)`
          )helpz--page-size   T)	unlimitedFzP            This flag specifies the maximum number of folders per page.
        )typerequire_coverage_in_testscategoryr   )display_info	AddFormatr	   
LIMIT_FLAGAddToParserSORT_BY_FLAGadd_argumentr   
BoundedIntsysmaxsizeLIST_COMMAND_FLAGS)parsers    .lib/surface/resource_manager/folders/search.pyArgsSearch.Args2   s    
!! # 	 	OO'!!&)
   ##As{{dC"'((      c           
         [         R                  " [        R                  " U R                  5      [        R
                  " U R                  5      R                  UR                  S9SUR                  SUR                  SS9$ )zRun the search command.)queryr   pageSizer   )methodlimitbatch_size_attribute
batch_sizefield)
r   YieldFromListr   FoldersServiceFOLDERS_API_VERSIONFoldersMessages(CloudresourcemanagerFoldersSearchRequestr%   r(   	page_size)selfargss     r    Run
Search.RunU   so    ##t778$$	&&N&Njj 'O '"jj'>>	 	r#    N)
__name__
__module____qualname____firstlineno____doc__r.   staticmethodr!   r4   __static_attributes__r6   r#   r    r   r      s'    "    Dr#   r   )r;   
__future__r   r   r   r   apitools.base.pyr   'googlecloudsdk.api_lib.resource_managerr   googlecloudsdk.callioper   r	   ReleaseTracksReleaseTrackALPHACommandr   r6   r#   r    <module>rF      s\    A &  ' 
 ' ; / ( D%%++,BT\\ B -Br#   