
    '                        S r SSKrSSKJr  SSKJr  SSKJr  SSKJr   SS\	S\R                  4S	 jjrS
\R                  S\R                  4S jrSS\R                  4S jjrSS\R                  4S jjrSS\R                  4S jjrSS\R                  4S jjr SS
\R                  S\R                  4S jjrS
\R                  S\4S jrSS\R                  4S jjrSS\R                  4S jjrS\R                  4S jr SS\	S\S\R                  4S jjrS\4S jrS\R                  4S jr SS\	S\R                  4S jjrg)z+Specify common flags for management gcloud.    N)arg_parsers)base)
completers)	constantsresource_namereturnc                 :   [         R                  " SUS9nUR                  [         R                  " SS[        R
                  " SR                  U 5      5      S95        UR                  [         R                  " SSS[        R                  S	R                  U 5      S
95        UR                  [         R                  " SSS[        R                  SR                  U 5      S
95        UR                  [         R                  " SSSSR                  U 5      S95        U$ )a  Returns a flag for capturing an org, project, or folder name.

The flag can be provided in one of 2 forms:
  1. --parent=organizations/<id>, --parent=projects/<id or name>,
  --parent=folders/<id>
  2. One of:
    * --organizations=<id> or organizations/<id>
    * --projects=<id or name> or projects/<id or name>
    * --folders=<id> or folders/<id>

Args:
  resource_name: The name of the resource for which the flag is created. The
    default value is set to 'custom module'.
  required: whether or not this flag is required
Tmutexrequired--parentFzrParent associated with the {}. Can be one of
              organizations/<id>, projects/<id or name>, folders/<id>r   help--organizationORGANIZATION_ID$Organization associated with the {}.r   metavar	completerr   	--projectPROJECT_ID_OR_NUMBERProject associated with the {}.z--folder	FOLDER_IDzFolder associated with the {}.r   r   r   
r   ArgumentGroupAddArgumentArgumenttextwrapdedentformatr   OrganizationCompleterProjectCompleterr   r   roots      2lib/googlecloudsdk/command_lib/scc/manage/flags.pyCreateParentFlagr'      s   & 
		$	:$
mm
IIOJ	 
mm
#445<<]K 
mm
(//077F 
mm
/66}E	 
+    module_typec                 L    [         R                  " SSR                  SU 5      S9$ )z>A positional argument representing a custom module ID or name.module_id_or_namea  The custom module ID or name. The expected format is {parent}/[locations/global]/MODULE_TYPE/{module_id} or just {module_id}. Where module_id is a numeric identifier 1-20 characters
      in length. Parent is of the form organizations/{id}, projects/{id or name},
      folders/{id}.MODULE_TYPEr   )r   r   replace)r)   s    r&   CreateModuleIdOrNameArgr/   [   s,     
w
	
 r(   c                 X    [         R                  " SU SS[        R                  " 5       S9$ )Nz--custom-config-from-fileCUSTOM_CONFIGz)Path to a YAML custom configuration file.r   r   r   typer   r   r   FileContentsr   s    r&   CreateCustomConfigFlagr7   i   s+    	!:##%
 r(   c                 X    [         R                  " SU SS[        R                  " 5       S9$ )Nz--resource-from-file	TEST_DATAztPath to a YAML file that contains the resource data to validate the Security Health Analytics custom module against.r2   r4   r6   s    r&   CreateTestResourceFlagr:   s   s.    	 F##%
 r(   c                 0    [         R                  " SU SSS9$ )Nz--module-typer,   zType of the custom module. For a list of valid module types please visit https://cloud.google.com/security-command-center/docs/custom-modules-etd-overview#custom_modules_and_templates.r   r   r   r6   s    r&   CreateModuleTypeFlagr=   }   s"    	 J	
 r(   c                 2    [         R                  " SU S SSS9$ )Nz--validate-only
store_truezSIf present, the request is validated (including IAM checks) but no action is taken.)r   defaultactionr   r<   r6   s    r&   CreateValidateOnlyFlagrB      s"    	d
 r(   c           
          [         R                  " SUS9nUR                  [         R                  " SSSSR	                  U5      [
        R                  " 5       S95        UR                  [        SU S95        U$ )zBReturns a custom-config flag or an enablement-state flag, or both.Fr
   --custom-config-fileNzHPath to a {} file that contains the custom config to set for the module.r   r@   r   r3   )r   r)   )r   r   r   r   r!   r   r5   CreateEnablementStateFlag)r)   	file_typer   r%   s       r&   CreateUpdateFlagsrH      sy     
		%(	;$
mm
 ]dd '')
 KH 
+r(   r   c                     U [         R                  R                  :X  a  SnO U [         R                  R                  :X  a  Sn[        R
                  " SUSSR                  W5      S9$ )z!Creates an enablement state flag.zSecurity Health AnalyticszEvent Threat Detection--enablement-stateNzeSets the enablement state of the {} custom module. Valid options are ENABLED, DISABLED, OR INHERITED.r   r@   r   )r   CustomModuleTypeSHAETDr   r   r!   )r)   r   module_names      r&   rF   rF      sa    
 I..222-Ki00444*K	v}}
	
 r(   c                 X    [         R                  " SU SS[        R                  " 5       S9$ )NrD   r1   zBPath to a JSON custom configuration file of the ETD custom module.r2   r4   r6   s    r&   !CreateEtdCustomConfigFilePathFlagrQ      s+    	S##%
 r(   c                 0    [         R                  " SU SSS9$ )Nz--display-namezDISPLAY-NAMEz&The display name of the custom module.r   r<   r6   s    r&   CreateDisplayNameFlagrS      s    	7	
 r(   c                      SR                  [        R                   V s/ s H  n [        U 5      PM     sn 5      n[        R
                  " SSU 3S9$ s  sn f )z4A positional argument representing the service name.z

* service_namezThe service name, provided either in lowercase hyphenated form (e.g. security-health-analytics), or in abbreviated form (e.g. sha) if applicable.

The list of supported services is:

* r-   )joinr   SUPPORTED_SERVICESstrr   r   )servicevalid_service_namess     r&   CreateServiceNameArgr[      s]     #,#?#?@#?s7|#?@ 
 ""$
  As   ArG   c           
          [         R                  " SUS9nUR                  [         R                  " SSSSU  S3[        R
                  " 5       S95        UR                  [        SS95        U$ )	zBReturns a module-config flag or an enablement-state flag, or both.Fr
   z--module-config-fileNz
Path to a zN file that contains the module config to set for the given module and service.rE   r6   )r   r   r   r   r   r5    CreateServiceEnablementStateFlag)rG   r   r%   s      r&   CreateServiceUpdateFlagsr^      ss     
		%(	;$
mm
 9+ &7 7 '')	 3UCD	+r(   c                 0    [         R                  " SU SSS9$ )z(Creates a service enablement state flag.rJ   NzSets the enablement state of the Security Center service.
      Valid options are ENABLED, DISABLED, OR INHERITED. The INHERITED
      state is only valid when setting the enablement state at the project or folder level.rK   r<   r6   s    r&   r]   r]      s$     
_	
 r(   c                  ,    [         R                  " SSS9$ )zIAn optional argument representing a comma separated list of module names.z--filter-modulesa  If provided, only prints module information for modules specified
      in the list. Provided as a comma separated list of module names in
      SCREAMING_SNAKE_CASE format (e.g. WEB_UI_ENABLED, API_KEY_NOT_ROTATED).
      A single module name is also valid.r-   r<    r(   r&   CreateModuleListrb     s    	-
 r(   c                    [         R                  " SUS9nUR                  [         R                  " SS[        R
                  " SR                  U 5      5      S95        UR                  [         R                  " SSS[        R                  S	R                  U 5      S
95        UR                  [         R                  " SSS[        R                  SR                  U 5      S
95        U$ )a  Returns a flag for capturing an org, project name.

The flag can be provided in one of 2 forms:
  1. --parent=organizations/<id>, --parent=projects/<id or name>
  2. One of:
    * --organizations=<id> or organizations/<id>
    * --projects=<id or name> or projects/<id or name>

Args:
  resource_name: The name of the resource for which the flag is created. The
    default value is set to 'billing metadata'.
  required: whether or not this flag is required

Returns:
  A base.Argument object.
Tr
   r   FzfParent associated with the {}. Can be one of
                organizations/<id>, projects/<id or name>r   r   r   r   r   r   r   r   r   r$   s      r&   CreateFlagForParentrd     s    ( 
		$	:$
mm
==CV>	 
mm
#445<<]K 
mm
(//077F 
+r(   )zcustom moduleF)T)F)zbilling metadataF)__doc__r   googlecloudsdk.callioper   r   +googlecloudsdk.command_lib.resource_managerr   %googlecloudsdk.command_lib.scc.manager   rX   r   r'   rL   r/   r7   r:   r=   rB   rH   boolrF   rQ   rS   r[   r^   r]   rb   rd   ra   r(   r&   <module>rj      sk   2  / ( B ; 49??	]]?D++	]]T]] T]] 4== dmm  ++ 
]]	2++& DMM dmm &  
]].$--  7<77	]]7r(   