
    
                     f    d dl mZ d dl mZ d dl mZ d dlZd dlmZ d dlmZ d Z	d Z
d	 Zd
 Zd Zy)    )absolute_import)division)unicode_literalsN)
exceptions)
propertiesc                     | j                  d      }|j                  dd       |j                  dd       |j                  dd	       y
)z<Add args for the parent resource of a request to the parser.F)requiredz	--projectzProject number or id. Only one of --project, --folder, or --organization can be provided. If none are provided then it uses config property [core/project].)helpz--folderzFolder number. Only one of --project, --folder, or --organization can be provided. If none are provided then it uses config property [core/project].z--organizationzOrganization number. Either --project, --folder, or --organization must be provided. If none are provided then it uses config property [core/project].N)add_mutually_exclusive_groupadd_argument)parserparent_groups     8lib/googlecloudsdk/command_lib/access_approval/parent.pyArgsr      sm    44e4D, i    b    d      c                    dt        d | j                  | j                  | j                  fD              k(  r7t        j
                  j                  j                  j                         | _        d}| j                  r&t        | j                         d| j                  z  }|S | j                  r&t        | j                         d| j                  z  }|S t        | j                         d| j                  z  }|S )zCReturns the parent resource from args or the active gcloud project.r   c              3   2   K   | ]  }t        |        y w)N)bool).0xs     r   	<genexpr>zGetParent.<locals>.<genexpr>-   s     NM!d1gMs   Nzprojects/%sz
folders/%szorganizations/%s)sumprojectfolderorganizationr   VALUEScore	GetOrFail_ValidateProject_ValidateFolder_ValidateOrganization)argsparents     r   	GetParentr$   +   s    #Ndkk4;L;LMN
NN $$))11;;=DL&	\\T\\"T\\)F 
- {{DKK DKK'F
 
- $++,$"3"33F	-r   c                 \    t        j                  d|       st        j                  d|       y )Nz^[a-z0-9-]+$r   rematchr   InvalidArgumentException
flag_values    r   r   r   @   s(    	.*	-

-
-i
DD 
.r   c                 \    t        j                  d|       st        j                  d|       y )N^[0-9]+$r   r&   r*   s    r   r    r    E   s(    	*j	)

-
-h

CC 
*r   c                 \    t        j                  d|       st        j                  d|       y )Nr-   r   r&   r*   s    r   r!   r!   J   s(    	*j	)

-
-nj
II 
*r   )
__future__r   r   r   r'   googlecloudsdk.callioper   googlecloudsdk.corer   r   r$   r   r    r!    r   r   <module>r3      s5     '  ' 	 . *"*E
D
Jr   