
    G                         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rS rS	 r\R                  S
 5       rS rS rS rS rS rS rSS jrS rS rS rS rSS jrg)z.Flags for commands that deal with the CRM API.    )
exceptions)arg_parsers)base)concepts)concept_parsersNc                 L    [         R                  " SSSR                  U 5      S9$ )Nid	FOLDER_IDID for the folder {0}metavarhelpr   Argumentformatuse_descriptions    8lib/googlecloudsdk/command_lib/resource_manager/flags.pyFolderIdArgr      s'    	
"))/:
     c                 L    [         R                  " SSSR                  U 5      S9$ )Nr	   CAPABILITY_IDzID for the capability {0}r   r   r   s    r   CapabilityIdArgr   #   s'    	
&--o>
 r   c                 N    [         R                  " SSS SR                  U 5      S9$ )N--folderr
   r   )r   defaultr   r   r   s    r   FolderIdFlagr   +   s*    	"))/:	
 r   c                 L    [         R                  " SSSR                  U 5      S9$ )N--organizationORGANIZATION_IDzID for the organization {0}r   r   r   s    r   OrganizationIdFlagr!   5   s'    	(//@
 r   c                 L    [         R                  " SSSR                  U 5      S9$ )Nr	   OPERATION_IDzID for the operation {0}r   r   r   s    r   OperationIdArgr$   =   s'    	
%,,_=
 r   c                  "    [         R                  $ )N)r   
ASYNC_FLAG r   r   OperationAsyncFlagr(   E   s    	r   c                 L    [         R                  " SSSR                  U 5      S9$ )Nr	   LIEN_IDzID for the lien {0}r   r   r   s    r   	LienIdArgr+   I   s'    	
 ''8
 r   c                 l    [        S5      R                  U 5        [        S5      R                  U 5        g )Nzto use as a parent)r   AddToParserr!   )parsers    r   AddParentFlagsToParserr/   Q   s*    #$008)*66v>r   c                     [        U SS 5      (       a  SR                  U R                  5      $ U R                  (       a  SR                  U R                  5      $ g )Nfolderzfolders/{0}zorganizations/{0})getattrr   r1   organization)argss    r   GetParentFromFlagsr5   V   sI    T8T"",,%%d&7&788r   c                 `   [        U SS5      (       a(  U R                  (       a  [        R                  " SS5      eU(       am  SU ;   a8  U R                  (       d'  U R                  (       d  [
        R                  " S5      eSU ;  a(  U R                  (       d  [
        R                  " S5      eggg)a^  Assert that there are no conflicts with parent flags.

Ensure that both the organization flag and folder flag are not set at the
same time. This is a little tricky since the folder flag doesn't exist for
all commands which accept a parent specification.

Args:
  args: The argument object
  parent_required: True to assert that a parent flag was set
r1   Nr   r   zBNeither --folder nor --organization provided, exactly one requiredz--organization is required)r2   r3   calliope_exceptionsConflictingArgumentsExceptionr1   r   ArgumentError)r4   parent_requireds     r   CheckParentFlagsr;   _   s     T8T""t'8'8

;
;$  4D4E4E$$
N  
	d&7&7$$%ABB '8	 r   c                  ,    [         R                  " SSS9$ )Nr1   zThe folder id)name	help_text)r    ResourceParameterAttributeConfigr'   r   r   FolderAttributeConfigr@   w   s    		2	2
 r   c                  @    [         R                  " SSS[        5       S9$ )Nzcloudresourcemanager.foldersr1   v2)resource_nameapi_version	foldersId)r   ResourceSpecr@   r'   r   r   GetFolderResourceSpecrG   }   s$    			$%'	
 r   c                 p    [         R                  R                  S[        5       SR	                  U 5      SS9$ )N	folder_idz ID for the folder you want to {}T)required)r   ConceptParserForResourcerG   r   )verbs    r   GetFolderResourceArgrN      s:    		&	&	2	2(//5	 
3 
 r   c            	          / SQn [         R                  " SS[        R                  " 5       [        R                  SR                  U 5      S9$ )z(Makes the base.Argument for --tags flag.)z%List of tags KEY=VALUE pairs to bind.zEach item must be expressed asz4`<tag-key-namespaced-name>=<tag-value-short-name>`.
z?Example: `123/environment=production,123/costCenter=marketing`
z)Note: Currently this field is in Preview.z--tagsz	KEY=VALUE
)r   typeactionr   )r   r   r   ArgDictUpdateActionjoin)
help_partss    r   TagsFlagrW      sC    * 
 %%99Z 
 r   c                     [        X5      nU(       d  gU" [        [        R                  " U5      5       VVs/ s H  u  pEUR	                  XES9PM     snnS9$ s  snnf )zMakes the tags message object.N)keyvalue)additionalProperties)r2   sortedsix	iteritemsAdditionalProperty)r4   tags_messagetags_arg_nametagsrY   rZ   s         r   GetTagsFromFlagsrc      s_    		%$		 #3==#677jc 
)
)c
)
?7
 s   A
)T)rb   )__doc__'googlecloudsdk.api_lib.resource_managerr   googlecloudsdk.callioper   r   r7    googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   r]   r   r   Hiddenr   r!   r$   r(   r+   r/   r5   r;   r@   rG   rN   rW   rc   r'   r   r   <module>rj      s    5 ? / ( E 5 D 
  ?
C0$r   