
    s	                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 dZd	Z G d
 de
j                        Zd Zd Zd Zy)z*CLI Utilities for beyondcorp app commands.    )absolute_import)division)unicode_literals)base)labels_util)
exceptionszVError parsing member [{}]: member must be prefixed of the form serviceAccount:<value>.serviceAccountc                       e Zd ZdZy)MemberParseErrorz+Error if a member is not in correct format.N)__name__
__module____qualname____doc__     5lib/googlecloudsdk/command_lib/beyondcorp/app/util.pyr   r      s    3r   r   c                     | j                  d      }t        |      dk(  r|d   t        k(  r|d   S t        t        j                  |             )ab  Validates and parses a service account from member string.

  Expects string.

  Args:
    member: string in format of 'serviceAccount:<value>'.

  Raises:
    MemberParseError: if string is not in valid format 'serviceAccount:<value>',
    raises exception MemberParseError.

  Returns:
    string: Returns <value> part from 'serviceAccount:<value>'.
  :   r      )splitlenMEMBER_PREFIXr   MEMBER_PARSE_ERRORformat)membermember_arrays     r   MemberProcessorr   #   sO     c",!Q= @?
!!&)+ +r   c                      t        j                  d      } | j                  t        j                                | j                  t        j
                  d             t        j                  d      | gS )z"Defines flags for updating labels.T)mutex )r   ArgumentGroupAddArgumentr   GetClearLabelsFlagGetRemoveLabelsFlagGetUpdateLabelsFlag)remove_groups    r   UpdateLabelsFlagsr(   ;   sX    ##$/,;99;<;::2>?

)
)"
-|	<<r   c                 v    |j                   }|r#|j                  |       dk(  r|dz   | z   |_         |S | |_         |S )z"Adds name of field to update mask.r   ,)
updateMaskcount)fieldpatch_requestupdate_masks      r   AddFieldToUpdateMaskr0   C   sM    ((+1$!,s!2U!:m 
  %M	r   N)r   
__future__r   r   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   r   Errorr   r   r(   r0   r   r   r   <module>r6      sJ     1 &  ' ( < *9  4z'' 4+0=r   