
                             S 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                  5       " S S\R                  5      5       rS rSS
 jrg	)zThe `groups preview` command.    )admin_directory)arg_parsers)base)	arg_utilsc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Preview   zBRetrieve a list of users in a customer account using CEL query.
  z{description}a            To retrieve a list of user in a customer and filter it with a query, run:

            $ {command} --query="user.locations.exists(loc, loc.desk_code == 'abc')" --customer=A1234abcd

          To retrieve a list of users with only fullName and primaryEMail fields, run:

            $ {command} --query="user.locations.exists(loc, loc.desk_code == 'abc')" --customer=A1234abcd --format="flattened(nextPageToken, users[].primaryEmail, users[].name.fullName)"

          )DESCRIPTIONEXAMPLESc                 H   U R                  SS9nUR                  SSS9  U R                  SSS9  U R                  S/ S	QS
SS9  U R                  SS[        R                  " 5       SS9  U R                  SSS/SSS9  U R                  SS[        SS9  U R                  SSS9  g )NT)requiredz
--customerz3The customer ID for the customer's G Suite account.)helpz--queryz4Query string using CEL and supported user attributesz--projection)basicfullcustomr   z)Subsets of fields to fetch for this user.)choicesdefaultr   z--custom-field-maskzcustom-maskzA comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when --projection=custom.)metavartyper   z--view-typez
admin-viewzdomain-publiczOWhether to fetch the administrator-only or domain-wide public view of the user.z--max-resultsd   zOMaximum number of results to return. Acceptable values are 1 to 500, inclusive.)r   r   r   z--page-tokenz'Token to specify next page in the list.)add_mutually_exclusive_groupadd_argumentr   ArgListint)parser
scope_argss     &lib/surface/identity/groups/preview.pyArgsPreview.Args-   s    44d4CJD  G D  G +8	  :
   "%	  ' /"	  $  	  " G  J    c                    [         R                  " 5       n[        UR                  UR                  R
                  5      n[        UR                  UR                  R                  5      n[         R                  " UR	                  UR                  UR                  UUR                  UUR                  UR                  S95      $ )N)customerquery
projectioncustomFieldMaskviewType
maxResults	pageToken)r   GetMessagesChoiceToEnumr$   DirectoryUsersListRequestProjectionValueValuesEnum	view_typeViewTypeValueValuesEnumr   r"   r#   custom_field_maskmax_results
page_token)selfargsmessagesr$   r-   s        r   RunPreview.RunS   s    **,H		+	+	E	EHJ 		+	+	C	CFI ""**]]**! 22''oo 	+ 	'( (r     N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r5   __static_attributes__r7   r    r   r   r      s4    
 		-  #J #JJ(r    r   c                 &    U R                  SS5      $ )zDConverts an argument value to the string representation of the Enum.-_)replace)choices    r   ChoiceToEnumNamerE   g   s    	S	!!r    Nc                    U c  g[        U 5      nU=(       d5    UR                  5        Vs/ s H  n[        R                  " U5      PM     snn UR	                  U5      $ s  snf ! [
         aY    [        R                  " SR                  U[        R                  " U5      SR                  S [        U5       5       5      S95      ef = f)z6Converts the typed choice into an apitools Enum value.Nz;Invalid {item}: {selection}. Valid choices are: [{values}].z, c              3   $   #    U  H  ov   M     g 7f)Nr7   ).0cs     r   	<genexpr>ChoiceToEnum.<locals>.<genexpr>{   s     >(=1Q(=s   )item	selectionvalues)rE   namesr   EnumNameToChoicelookup_by_nameKeyErrorr   ArgumentTypeErrorformatjoinsorted)rD   	enum_type	item_typevalid_choicesnamens         r   r*   r*   l   s    ^	&	!$ A.7oo.?@.?y!!!$.?@ A##D)) A 
 A

'
'ELL00699>}(=>> 	M 	@A AAs    A A% %A#C)rD   N)r<   googlecloudsdk.api_lib.identityr   googlecloudsdk.callioper   r   $googlecloudsdk.command_lib.util.apisr   ReleaseTracksReleaseTrackALPHABETACommandr   rE   r*   r7   r    r   <module>rd      sl    $ < / ( : D%%++T->->-C-CDK(dll K( EK(\"
Ar    