
    ;                     n   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r " S	 S
\	R                  5      r   S&S jrS&S jrS'S jr   S&S jrS rS rS rS rS rS(S jrS)S jrS*S jrS)S jrS(S jrS(S jrS(S jrS(S jrS(S jr S(S jr!S+S jr"S(S  jr#S(S! jr$S(S" jr%S# r&S$ r'S% r(g),zJFlags and helpers for the compute organization security policies commands.    )absolute_import)division)unicode_literals)arg_parsers)
completers)flagsz[    table(
      name:label=ID,
      displayName,
      shortName,
      description
    )c                   (   ^  \ rS rSrU 4S jrSrU =r$ )OrgSecurityPoliciesCompleter#   c                 4   > [         [        U ]
  " SSSS.UD6  g )N$compute.organizationSecurityPoliciesz-beta compute org-security-policies list --uri)
collectionlist_command )superr
   __init__)selfkwargs	__class__s     Elib/googlecloudsdk/command_lib/compute/org_security_policies/flags.pyr   %OrgSecurityPoliciesCompleter.__init__%   s(    	
&6 9D     r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__)r   s   @r   r
   r
   #   s     r   r
   Nc                 ^    [         R                  " SS[        UU SSR                  U5      SS9$ )NSECURITY_POLICYsecurity policysecurity policiesz)Short name of the security policy to {0}.r   nameresource_name	completerpluralrequiredcustom_plural
short_helpglobal_collectioncompute_flagsResourceArgumentr
   formatr(   r'   	operations      r   !OrgSecurityPolicyRuleListArgumentr2   -   s:     
	'	'%,'<CCIN>	
 	r   c                 ^    [         R                  " SS[        UU SSR                  U5      SS9$ )Nr    r!   r"   z/Short name or ID of the security policy to {0}.r   r#   r,   r0   s      r   OrgSecurityPolicyArgumentr4   <   s=    		'	'%,'BII
 ?
 r   c           	      <    [         R                  " SS[        UU SS9$ )Nr$   associationr   )r$   r%   r&   r'   r(   r+   )r-   r.   r
   )r(   r'   s     r   %OrgSecurityPolicyAssociationsArgumentr7   K   s)    		'	'!,>
@ @r   c                 \    [         R                  " SS[        UU SSR                  U5      S9$ )Npriorityzsecurity policy ruler   z+Priority of the security policy rule to {}.)r$   r%   r&   r'   r(   r+   r*   r,   r0   s      r   OrgSecurityPolicyRuleArgumentr:   U   s:    
 
	'	'*,>>EE

 r   c                 V   U R                  SSS9  U R                  SSS9  U R                  SSS9nUR                  SSS9  UR                  S	S
S9  U R                  SSS9  U R                  SSS9nUR                  SSS/S SSS9  UR                  SSS9  U R                  SSS/SS9  g)z/Adds the argument for security policy creation.z--display-namez&A textual name of the security policy.helpz--short-nameTr(   mutex--organizationzHOrganization in which the organization security policy is to be created.--folderzBFolder in which the organization security policy is to be created.--descriptionFAn optional, textual description for the organization security policy.zCreation options.)r?   r=   z--typeCLOUD_ARMORFIREWALLc                 B    U R                  5       R                  SS5      $ )N-_)upperreplacexs    r   <lambda>"AddArgSpCreation.<locals>.<lambda>   s    QWWY&&sC0r   SECURITY_POLICY_TYPEzHThe type indicates the intended use of the organization security policy.)choicestypemetavarr=   z--file-namezWThe name of the JSON or YAML file to create a organization security policy config from.z--file-formatjsonyamlzThe format of the file to create the organization security policy config from. Specify either yaml or json. Defaults to yaml if not specified. Will be ignored if --file-name is not specified.)rP   r=   N)add_argument	add_group)parsergroupcreation_optionss      r   AddArgSpCreationrZ   e   s'   E   	C   

D

5%!  #
   
 	  
 %%D7J%Kj)0$   	 )    	vH	  r   c                 F    U R                  SSSS9  U R                  SSS9  g)	z1Adds the argument for security policy copy rules.z--source-security-policyTz=The URL of the source security policy to copy the rules from.r(   r=   r@   z~Organization in which the organization security policy to copy the rules to. Must be set if security-policy is the short name.r<   NrU   rW   s    r   AddArgsCopyRulesr_      s=     K  N
 	I  r   c                 d    U R                  SSS9nUR                  SSS9  UR                  SSS9  g)	z+Adds the argument for security policy list.Tr>   r@   z2Organization in which security policies are listedr<   rA   z,Folder in which security policies are listedNrV   rU   rW   rX   s     r   AddArgsListSprc      sM    


D

5%@  C F  Ir   c                 D    U R                  SSS9  U R                  SSS9  g)z+Adds the argument for security policy move.r@   zxOrganization in which the organization security policy is to be moved. Must be set if SECURITY_POLICY is the short name.r<   rA   z@Folder to which the organization security policy is to be moved.Nr]   r^   s    r   AddArgsMovere      s;    F   	  r   c                 D    U R                  SSS9  U R                  SSS9  g)z-Adds the argument for security policy update.r@   zzOrganization in which the organization security policy is to be updated. Must be set if SECURITY_POLICY is the short name.r<   rB   rC   Nr]   r^   s    r   AddArgsUpdateSprg      s;    H   	  r   c           
          U R                  SU(       a  SOS-   SU(       a  SOS[        SR                  U(       a  SOSU5      S9  g)	z+Adds the priority argument to the argparse.r$   s PRIORITY*NzPriority of the rule{0} to {1}. Rules are evaluated in order from highest priority to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority.)rR   nargsr&   r=   )rU   r
   r/   )rW   r1   	is_plurals      r   AddPriorityro      sF    yb)C$,>>Df b)?5  7r   c                 <    U R                  SSSSSSSSS	.S
 USS9  g)z)Adds the action argument to the argparse.z--actionz/Allows the request from HTTP(S) Load Balancing.z7Defers enforcement to the next policy in the hierarchy.z2(DEPRECATED) Only used for Hierarchical Firewalls.zYDenies the request from HTTP(S) Load Balancing, with an HTTP response status code of 403.zYDenies the request from HTTP(S) Load Balancing, with an HTTP response status code of 404.zYDenies the request from HTTP(S) Load Balancing, with an HTTP response status code of 502.zMRedirects the request from HTTP(S) Load Balancing, based on redirect options.)allowz	goto-nextdenyzdeny-403zdeny-404zdeny-502redirectc                 "    U R                  5       $ N)lowerrK   s    r   rM   AddAction.<locals>.<lambda>  s
    QWWYr   z:Action to take if the request matches the match condition.)rP   rQ   r(   r=   Nr]   rW   r(   s     r   	AddActionry      sE    DGF---"'. G7  r   c                 D    U R                  SUSR                  U5      S9  g)z5Adds the security policy ID argument to the argparse.--security-policyzCshort name of the security policy into which the rule should be {}.r\   NrU   r/   )rW   r(   r1   s      r   AddSecurityPolicyIdr}   	  s*    6)$  r   c                 &    U R                  SUSS9  g )Nr@   zmOrganization which the organization security policy belongs to. Must be set if SECURITY_POLICY is short name.r\   r]   rx   s     r   AddOrganizationr     s     :	  r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the source IP ranges.z--src-ip-rangesSRC_IP_RANGEzWSource IP ranges to match for this rule. Can only be specified if DIRECTION is ingress.rQ   r(   rR   r=   NrU   r   ArgListrx   s     r   AddSrcIpRangesr      s/     =  ?r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the destination IP ranges.z--dest-ip-rangesDEST_IP_RANGEz[Destination IP ranges to match for this rule. Can only be specified if DIRECTION is egress.r   Nr   rx   s     r   AddDestIpRangesr   +  s/     <  >r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the destination ports.z--dest-ports
DEST_PORTSPA list of destination protocols and ports to which the firewall rule will apply.r   Nr   rx   s     r   AddDestPortsr   6  s/       !r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the layer4 configs.z--layer4-configsLAYER4_CONFIGr   r   Nr   rx   s     r   AddLayer4Configsr   A  s/       !r   c                 ,    U R                  SUSS/SS9  g)z?Adds the direction of the traffic to which the rule is applied.z--directionINGRESSEGRESSzZDirection of the traffic the rule is applied. The default is to apply on incoming traffic.)r(   rP   r=   Nr]   rx   s     r   AddDirectionr   L  s(    (#'  r   c                 D    U R                  SU[        R                  SS9  g)z"Adds the option to enable logging.z--enable-loggingzSUse this flag to enable logging of connections that allowed or denied by this rule.)r(   actionr=   N)rU   r   StoreTrueFalseActionrx   s     r   AddEnableLoggingr   Y  s)    --#	  %r   c                 B    U R                  SSR                  U5      S9  g)z;Adds the new security policy rule priority to the argparse.z--new-priorityz6New priority for the rule to {}. Valid in [0, 65535]. r<   Nr|   )rW   r1   s     r   AddNewPriorityr   c  s)    DKK
  r   c                 P    U R                  S[        R                  " 5       SUSS9  g)z1Adds the target resources the rule is applied to.z--target-resourcesTARGET_RESOURCESz>List of URLs of target resources to which the rule is applied.rQ   rR   r(   r=   Nr   rx   s     r   AddTargetResourcesr   k  s.      L  Or   c                 P    U R                  S[        R                  " 5       SUSS9  g)z.Adds the target service accounts for the rule.z--target-service-accountsTARGET_SERVICE_ACCOUNTSz-List of target service accounts for the rule.r   Nr   rx   s     r   AddTargetServiceAccountsr   u  s-    ! ';  >r   c                 &    U R                  SUSS9  g)z"Adds the description of this rule.rB   z.An optional, textual description for the rule.r\   Nr]   rx   s     r   AddDescriptionr     s    <  ?r   c                    U R                  SSSS9  U R                  SSS9  U R                  SSS	9nUR                  S
SS9  UR                  SSS9  U R                  SSSSSS9  U R                  SSS9  U R                  S[        R                  " 5       SSSS9  U R                  S[        R                  " 5       SSSS9  g)z+Adds the arguments of association creation.r{   Tz&Security policy ID of the association.r\   r@   zkID of the organization to associate the security policy with. Must be set if SECURITY_POLICY is short name.r<   Fr>   rA   z7ID of the folder to associate the security policy with.z--project-numberz5Project number to associate the security policy with.z--replace-association-on-target
store_truea  By default, if you attempt to insert an association to an organization or folder resource that is already associated with a security policy the method will fail. If this is set, the existing  association will be deleted at the same time that the new association is created.)r   defaultr(   r=   z--namezName to identify this association. If unspecified, the name will be set to "organization-{ORGANIZATION_ID}" or "folder-{FOLDER_ID}".z--excluded-projectsEXCLUDED_PROJECTSzList of projects to exclude from the application of this security policy. Projects should be specified in the form "projects/123".r   z--excluded-foldersEXCLUDED_FOLDERSzList of folders to exclude from the application of this security policy. Folders should be specified in the form "folders/123".N)rU   rV   r   r   rb   s     r   AddArgsCreateAssociationr     s)   4  7 	6   

E

6%P   B  
 	'$  
& 	'  ) 	 !N  	 	  L  	r   c                 F    U R                  SSSS9  U R                  SSS9  g)	z+Adds the arguments of association deletion.r{   Tz>short name or ID of the security policy ID of the association.r\   r@   ztID of the organization in which the security policy is to be detached. Must be set if SECURITY_POLICY is short name.r<   Nr]   r^   s    r   AddArgsDeleteAssociationr     s<    K   	E  r   c                 d    U R                  SSS9nUR                  SSS9  UR                  SSS9  g)	z'Adds the arguments of association list.Tr>   r@   z<ID of the organization with which the association is listed.r<   rA   z6ID of the folder with which the association is listed.Nra   rb   s     r   AddArgsListAssociationr     sM    


D

5%J  M D  Gr   )FFN)FF)F)T)TNru   ))__doc__
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   compute_completersr   r-   DEFAULT_LIST_FORMATListCommandCompleterr
   r2   r4   r7   r:   rZ   r_   rc   re   rg   ro   ry   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s    Q &  ' / O E	 #5#J#J  05-204@  8v 	I 
7B	?>!!
%O>?=@"
Gr   