
    E!                         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
Jr  SS	KJr  SS
KJr  / SQrS rS rS!S jrS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S r"S r#S r$g )"z+Flags for gcloud active-directory commands.    )absolute_import)division)unicode_literals)
exceptions)arg_parsers)base)concepts)labels_util)concept_parsers)z
asia-east1zasia-northeast1zasia-south1zasia-southeast1zaustralia-southeast1zeurope-north1zeurope-west1zeurope-west2zeurope-west3zeurope-west4znorthamerica-northeast1zsouthamerica-east1zus-central1zus-east1zus-east4zus-west1zus-west2c                  ^    [         R                  " SSS[         R                  [        5       S9$ )z Adds an operation resource spec.z6managedidentities.projects.locations.global.operations	operationF)resource_namedisable_auto_completers
projectsIdoperationsId)r	   ResourceSpec DEFAULT_PROJECT_ATTRIBUTE_CONFIGOperationAttributeConfig     8lib/googlecloudsdk/command_lib/active_directory/flags.pyGetOperationResourceSpecr   %   s-    			>#::+-
 r   c                  ,    [         R                  " SSS9$ )z#Adds an operation attribute config.r   z+Name of the Managed Microsoft AD operation.)name	help_text)r	    ResourceParameterAttributeConfigr   r   r   r   r   0   s    		2	2=
 r   c                     U(       a  SOSn[         R                  R                  U[        5       SR	                  U5      SS9R                  U 5        g)aF  Adds an operation resource argument.

NOTE: May be used only if it's the only resource arg in the command.

Args:
  parser: the argparse parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  positional: bool, if True, means that the instance ID is a positional rather
    than a flag.
NAMEz--operationzThe operation name {}.T)requiredN)r   ConceptParserForResourcer   formatAddToParser)parserverb
positionalr   s       r   AddOperationResourceArgr'   8   sL     =$++
 %%d+	 ,  ![(r   c                     UR                  S5      (       aT  UR                  R                  UR                  /-   n[	        [        U5      5      nX2R                  l        [        SU5        U$ )zAdds region to domain.
add_region	locations)IsSpecifieddomainr*   r)   sortedsetAddFieldToUpdateMask)unused_domain_refargspatch_requestlocss       r   AddRegionFlagr4   L   sZ    	l##))T__,==D#d)D%)"m4	r   c                 D   UR                  S5      (       a  UR                  R                   Vs/ s H  nX1R                  :w  d  M  UPM     nn[	        [        U5      5      nU(       d  [        R                  " S5      eXBR                  l        [        SU5        U$ s  snf )zRemoves region from domain.remove_regionzCannot remove all regionsr*   )	r+   r,   r*   r6   r-   r.   r   ActiveDirectoryErrorr/   )r0   r1   r2   locr3   s        r   RemoveRegionFlagr9   V   s    	o&&$++555$$$ 	5 	  #d)D++,GHH%)"m4	s   BBc                     UR                  S5      (       aS  UR                  R                  UR                  -   n[	        [        U5      5      nX2R                  l        [        SU5        U$ )z#Adds authorized networks to domain.add_authorized_networksauthorized_networks)r+   r,   authorizedNetworksr;   r-   r.   r/   )r0   r1   r2   anss       r   AddAuthorizedNetworksFlagr?   e   s[    	/00



1
1D4P4P
PC
S
C.1+.>	r   c                 
   UR                  S5      (       ag  UR                  R                   Vs/ s H  nX1R                  ;  d  M  UPM     nn[	        [        U5      5      nXBR                  l        [        SU5        U$ s  snf )z(Removes authorized networks from domain.remove_authorized_networksr<   )r+   r,   r=   rA   r-   r.   r/   )r0   r1   r2   anr>   s        r   RemoveAuthorizedNetworksFlagrC   o   s~    	233"))<<<r444 	<   S
C.1+.>	s   B B c                     UR                  S5      (       a'  UR                  UR                  l        [	        SU5        U$ )z)Updates audit logs config for the domain.enable_audit_logsaudit_logs_enabled)r+   rE   r,   auditLogsEnabledr/   )r0   r1   r2   s      r   UpdateAuditLogsEnabledrH   |   s9    	)**,0,B,BM)-}=	r   c                     UR                   nU(       a$  UR                  U 5      S:X  a  US-   U -   Ul         U$ Xl         U$ )z"Adds name of field to update mask.r   ,)
updateMaskcount)fieldr2   update_masks      r   r/   r/      sK    ((+1$!,s!2U!:m 
  %	r   c                  @    [        5       [        5       [        5       /-   $ )z!Adds all update domain arguments.)DomainUpdateLabelsFlagsRegionUpdateFlagsAuthNetUpdateFlagsr   r   r   AdditionalDomainUpdateArgumentsrS      s    	 	"&7&9;M;O%P	PPr   c                      [         R                  " SS9n U R                  [        5       5        U R                  [	        5       5        U $ )z#Defines flags for updating regions.Tmutex)r   ArgumentGroupAddArgumentDomainAddRegionFlagDomainRemoveRegionFlag)region_groups    r   rQ   rQ      s<    ##$/,.01134	r   c                      [         R                  " SS9n U R                  [        5       5        U R                  [	        5       5        U $ )z/Defines flags for updating authorized networks.TrU   )r   rW   rX   DomainAddAuthorizedNetworksFlag"DomainRemoveAuthorizedNetworksFlag)auth_net_groups    r   rR   rR      s<    %%D1.<>??AB	r   c                      [         R                  " SS9n U R                  [        R                  " 5       5        U R                  [        R
                  " S5      5        [        R                  " S5      U /$ z"Defines flags for updating labels.TrU    r   rW   rX   r
   GetClearLabelsFlagGetRemoveLabelsFlagGetUpdateLabelsFlagremove_groups    r   rP   rP      X    ##$/,;99;<;::2>?

)
)"
-|	<<r   c                      [         R                  " SS9n U R                  [        R                  " 5       5        U R                  [        R
                  " S5      5        [        R                  " S5      U /$ ra   rc   rg   s    r   PeeringUpdateLabelsFlagsrk      ri   r   c                      [         R                  " SS9n U R                  [        R                  " 5       5        U R                  [        R
                  " S5      5        [        R                  " S5      U /$ ra   rc   rg   s    r   BackupUpdateLabelsFlagsrm      ri   r   c                 >    [         R                  " [        S9" U 5      $ )zDefines valid GCP regions.)choices)r   ArgListVALID_REGIONS)values    r   RegionsTypers      s    			]	3E	::r   c                  p    [         R                  " SSR                  SR                  [        5      5      S9$ )z#Defines a flag for adding a region.z--add-regionz      An additional region to provision this domain in.
      If domain is already provisioned in region, nothing will be done in that
      region. Supported regions are: {}.
      , helpr   Argumentr"   joinrq   r   r   r   rY   rY      s0    	
 &=)
*
, ,r   c                  p    [         R                  " SSR                  SR                  [        5      5      S9$ )z%Defines a flag for removing a region.z--remove-regionz      A region to de-provision this domain from.
      If domain is already not provisioned in a region, nothing will be done in
      that region. Domains must be left provisioned in at least one region.
      Supported regions are: {}.
      ru   rv   rx   r   r   r   rZ   rZ      s0    	

 &=)
*
, ,r   c                  t    [         R                  " SS[        R                  " 5       [        R                  SS9$ )z0Defines a flag for adding an authorized network.z--add-authorized-networksAUTH_NET1, AUTH_NET2, ...z       A list of URLs of additional networks to peer this domain to in the form
       projects/{project}/global/networks/{network}.
       Networks must belong to the project.
      metavartypeactionrw   r   ry   r   rp   UpdateActionr   r   r   r]   r]      s3    	!) %%
	
 	r   c                  t    [         R                  " SS[        R                  " 5       [        R                  SS9$ )z2Defines a flag for removing an authorized network.z--remove-authorized-networksr}   z       A list of URLs of additional networks to unpeer this domain from in the
       form projects/{project}/global/networks/{network}.
       Networks must belong to the project.
      r~   r   r   r   r   r^   r^      s3    	$) %%
	
 	r   N)T)%__doc__
__future__r   r   r   'googlecloudsdk.api_lib.active_directoryr   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr	   $googlecloudsdk.command_lib.util.argsr
   (googlecloudsdk.command_lib.util.conceptsr   rq   r   r   r'   r4   r9   r?   rC   rH   r/   rS   rQ   rR   rP   rk   rm   rs   rY   rZ   r]   r^   r   r   r   <module>r      s    2 &  ' > / ( 5 < D)(
Q
===;
,	,r   