
                        
   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dlm
Z
 dd	lmZ dd
lmZ ddlmZ ddlmZ g dZdgZddZddZddZd Zd ZddZd ZddZ	 	 d	 	 	 	 	 ddZ	 	 	 d 	 	 	 	 	 	 	 d!dZy)"z6Flags for Security Profile Threat Prevention commands.    )absolute_import)annotations)division)unicode_literals)sp_api)arg_parsers)parser_arguments)concepts)deps)concept_parsers)presentation_specs)DEFAULT_ACTIONALLOWALERTDENYTHREAT_PREVENTIONc                   | j                  d|      }|j                  dt        j                         dd       |j                  dt        j                         dd	       |j                  d
t        j                         dd       y)z5Adds --antivirus, --severities, or --threat-ids flag.T)mutexrequiredz--severitiesSEVERITY_LEVELzeList of comma-separated severities where each value in the list indicates the severity of the threat.)typemetavarhelpz--threat-idsz	THREAT-IDzList of comma-separated threat identifiers where each identifier in the list is a vendor-specified Signature ID representing a threat type. z--antivirusPROTOCOLznList of comma-separated protocols where each value in the list indicates the protocol of the antivirus threat.N)	add_groupadd_argumentr   ArgList)parserr    severity_threatid_antivirus_argss      ;lib/googlecloudsdk/command_lib/network_security/sp_flags.py#AddSeverityorThreatIDorAntivirusArgr!   "   s    %+%5%58 &6 &" #// 3 0  #//  0 	 #// = 0     Nc                B    |xs t         }| j                  d||d       y )Nz--actionz8Action associated with antivirus, severity, or threat-id)r   choicesr   )DEFAULT_ACTIONSr   )r   actionsr   r$   s       r    AddActionArgr'   E   s+    &'E	  r"   c                ,    | j                  d|d       y )Nz--descriptionz)Brief description of the security profile)r   r   )r   )r   r   s     r    AddProfileDescriptionr)   O   s    6  r"   c                b   d}t        j                  ddt        j                  |      t        j                  ddd      t        j                  ddd	      t        j                  dd
d            }t        j                  ||dd      }t        j                  |g      j                  |       S )z-Adds Security Profile Threat Prevention type.security_profilez8networksecurity.organizations.locations.securityProfilesorganizationz2Organization ID to which the changes should apply.organizationsId)parameter_namelocationz$location of the {resource} - Global.locationsIdzName of the {resource}.securityProfilesId)resource_collectionresource_nameapi_versionr-   r0   r1   TzSecurity Profile Name.)nameconcept_specr   
group_help)
r
   ResourceSpecr   GetApiVersion ResourceParameterAttributeConfigr   ResourcePresentationSpecr   ConceptParserAddToParser)r   release_trackr5   resource_specpresentation_specs        r    AddSecurityProfileResourcerA   W   s    	$''
D&&&}5??

>*
 ;;

0&
 "BB

#-!-, )AA )	 
	&	&(9':	;	G	G	OOr"   c                      fdS )Nc                H    t        j                        | j                  z   S N)r   GetEffectiveApiEndpointr5   )xr>   s    r    <lambda>z MakeGetUriFunc.<locals>.<lambda>z   s    611-@166Ir"    )r>   s   `r    MakeGetUriFuncrI   y   s	    	IIr"   c                      } dk(  rd}g } r7|j                  t        j                   fddj                  |                   t	        j
                  dd|      S )z.Gets Google Cloud location resource attribute.-z
a wildcardc                      S rD   rH   defaults   r    rG   z)LocationAttributeConfig.<locals>.<lambda>   s    Gr"   z(Location of the resource. Defaults to {}r/   zLocation of the {resource}.)r5   	help_textfallthroughs)appendr   Fallthroughformatr
   r:   )rN   default_keywordrP   s   `  r    LocationAttributeConfigrU   }   sg    /^"O,6==oN	
 
	2	2-
 r"   c                 0    t        j                  dd      S )z2Gets Google Cloud organization resource attribute.r,   z"Organization ID of the {resource}.)r5   rO   )r
   r:   rH   r"   r    OrgAttributeConfigrW      s    		2	24
 r"   c                X    t        j                  ddt        |       t                     S )z?Constructs and returns the Resource specification for Location.z'networksecurity.organizations.locationsr/   rM   )r3   r0   r-   )r
   r8   rU   rW   rM   s    r    GetLocationResourceSpecrY      s)    			/)':(*	
 r"   c                |    t         j                  j                  dt        |      ||      j	                  |        y)a  Adds a resource argument for Google Cloud location.

  Args:
    parser: The argparse.parser to add the resource arg to.
    help_text: str, the text of the help message.
    required: bool, whether the argument is required.
    default: Optional default value for the arg.
  z
--locationrM   )r5   r?   r7   r   N)r   r<   ForResourcerY   r=   r   rO   r   rN   s       r    AddLocationResourceArgr]      s:     +++G<	 , 
 Kr"   c                V    | j                  dt        j                         d|||       y)zJAdds the `mirroringDeploymentGroups` arg for CustomMirroring SPs (Broker).z--mirroring-deployment-groupsMIRRORING_DEPLOYMENT_GROUPS)r   r   r   r   rN   N)r   r   r   r\   s       r    %AddCustomMirroringDeploymentGroupsArgr`      s2     	% +  r"   )T)NT)FrD   )FN)r   $parser_arguments.ArgumentInterceptorrO   strr   bool)zKList of comma-separated full names of mirroring-deployment-group resources.FN)r   ra   rO   rb   r   rc   rN   zlist[str] | None)__doc__
__future__r   r   r   r   9googlecloudsdk.api_lib.network_security.security_profilesr   googlecloudsdk.callioper   r	    googlecloudsdk.calliope.conceptsr
   r   (googlecloudsdk.command_lib.util.conceptsr   r   r%   DEFAULT_PROFILE_TYPESr!   r'   r)   rA   rI   rU   rW   rY   r]   r`   rH   r"   r    <module>rk      s    = & "  ' L / 4 5 1 D G>,-  FPDJ, 	0 0 c $	0  	r"   