
    c                     "   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 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#SAS! 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* r-S+ r.S>S, jr/S>S- jr0S>S. jr1S>S/ jr2S0 r3S1 r4S2 r5S>S3 jr6S>S4 jr7S>S5 jr8S6 r9S>S7 jr:S>S8 jr;S>S9 jr<S=S: jr=S>S; jr>g)BzJFlags and helpers for the compute organization firewall policies commands.    )absolute_import)division)unicode_literals)arg_parsers)
completers)flagszJ    table(
      name:label=ID,
      displayName,
      description
    )c                   (   ^  \ rS rSrU 4S jrSrU =r$ )FirewallPoliciesCompleter"   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.firewallPoliciesz(compute org-firewall-policies list --uri)
collectionlist_command )superr
   __init__)selfkwargs	__class__s     Alib/googlecloudsdk/command_lib/compute/firewall_policies/flags.pyr   "FirewallPoliciesCompleter.__init__$   s(    	
#T3 -?     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FIREWALL_POLICYfirewall policyfirewall policiesz)Short name of the firewall policy to {0}.r   nameresource_name	completerpluralrequiredcustom_plural
short_helpglobal_collectioncompute_flagsResourceArgumentr
   formatr(   r'   	operations      r   FirewallPolicyRuleListArgumentr2   ,   s:     
	'	'%)'<CCIN2	
 	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 firewall policy to {0}.r   r#   r,   r0   s      r   FirewallPolicyArgumentr4   ;   s=    		'	'%)'BII
 3
 r   c           	      4    [         R                  " SSUU SSS9$ )N--firewall-policyr!   z>Short name or ID of the firewall policy ID of the association.r   )r$   r%   r'   r(   r*   r+   )r-   r.   )r(   r'   s     r   "FirewallPolicyAssociationsArgumentr7   J   s'    		'	'%
J2	
 	r   c                 \    [         R                  " SS[        UU SSR                  U5      S9$ )Npriorityzfirewall policy ruler   z+Priority of the firewall policy rule to {}.)r$   r%   r&   r'   r(   r+   r*   r,   r0   s      r   FirewallPolicyRuleArgumentr:   W   s:    
 
	'	'*)2>EE


 
r   c                     U R                  S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  g)z.Adds the argument for firewall policy creaton.z--short-nameTzgA textual name of the firewall policy. The name must be 1-63 characters long, and comply with RFC 1035.r(   helpr(   mutex--organizationzHOrganization in which the organization firewall policy is to be created.r=   --folderzBFolder in which the organization firewall policy is to be created.--descriptionFAn optional, textual description for the organization security policy.N)add_argument	add_groupparsergroups     r   AddArgFirewallPolicyCreationrJ   i   s    7	   

D

5%   O  
 	  r   c                 F    U R                  SSSS9  U R                  SSS9  g)	z2Adds the argument for firewall policy clone rules.z--source-firewall-policyTz=The URL of the source firewall policy to copy the rules from.r<   r@   zzOrganization in which the organization firewall policy to copy the rules to. Must be set if firewall-policy is short name.rA   NrE   rH   s    r   AddArgsCloneRulesrN      s<     J   	E  r   c                 $    U R                  SSS9  g)zFAdds the argument for firewall policy force start progressive rollout.r@   zOrganization in which the organization firewall policy to start the rollout of resides. Must be set if firewall-policy is short name.rA   NrL   rM   s    r   #AddArgsForceStartProgressiveRolloutrP      s    O  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 firewall policy list.Tr>   r@   z2Organization in which firewall policies are listedrA   rB   z,Folder in which firewall policies are listedNrF   rE   rG   s     r   AddArgsListFirewallPolicyrS      sK    


D

5%?  
 E  r   c                 D    U R                  SSS9  U R                  SSS9  g)z+Adds the argument for firewall policy move.r@   ztOrganization in which the organization firewall policy is to be moved. Must be set if FIREWALL_POLICY is short name.rA   rB   z@Folder to which the organization firewall policy is to be moved.NrL   rM   s    r   AddArgsMoverU      s9    B   	M  r   c                 D    U R                  SSS9  U R                  SSS9  g)z-Adds the argument for firewall policy update.r@   zvOrganization in which the organization firewall policy is to be updated. Must be set if FIREWALL_POLICY is short name.rA   rC   rD   NrL   rM   s    r   AddArgsUpdateFirewallPolicyrW      s;    D   	  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.)metavarnargsr&   r=   )rE   r
   r/   )rH   r1   	is_plurals      r   AddPriorityr`      sF    yb)C$)<<BFcB	=  r   c                 0    U R                  S/ SQS USS9  g))Adds the action argument to the argparse.--action)allowdeny	goto_nextapply_security_profile_groupc                 "    U R                  5       $ Nlowerxs    r   <lambda>AddAction.<locals>.<lambda>   
    QWWYr   :Action to take if the request matches the match condition.choicestyper(   r=   NrL   rH   r(   s     r   	AddActionrv      s$    LG  r   c                 0    U R                  S/ SQS USS9  g)rb   rc   )mirrordo_not_mirrorrf   c                 "    U R                  5       $ ri   rj   rl   s    r   rn   *AddPacketMirroringAction.<locals>.<lambda>   rp   r   rq   rr   NrL   ru   s     r   AddPacketMirroringActionr|      s$    6G  r   c                 D    U R                  SUSR                  U5      S9  g)z5Adds the firewall policy ID argument to the argparse.r6   zCShort name of the firewall policy into which the rule should be {}.r<   NrE   r/   )rH   r(   r1   s      r   AddFirewallPolicyIdr      s*    6)$  r   c                 &    U R                  SUSS9  g )Nr@   zmOrganization which the organization firewall policy belongs to. Must be set if FIREWALL_POLICY is short name.r<   rL   ru   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_RANGEz(Source IP ranges to match for this rule.rt   r(   r]   r=   NrE   r   ArgListru   s     r   AddSrcIpRangesr     s-     5  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.r   Nr   ru   s     r   AddDestIpRangesr   !  s-     :  r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the layer4 configs.z--layer4-configsLAYER4_CONFIGzPA list of destination protocols and ports to which the firewall rule will apply.r   Nr   ru   s     r   AddLayer4Configsr   ,  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(   rs   r=   NrL   ru   s     r   AddDirectionr   :  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rE   r   StoreTrueFalseActionru   s     r   AddEnableLoggingr   G  s)    --!  r   c                 D    U R                  SU[        R                  SS9  g)z$Adds the option to disable the rule.z
--disabledzJUse this flag to disable the rule. Disabled rules will not affect traffic.r   Nr   ru   s     r   AddDisabledr   T  s)    --  r   c                 B    U R                  SSR                  U5      S9  g)z;Adds the new firewall policy rule priority to the argparse.z--new-priorityz6New priority for the rule to {}. Valid in [0, 65535]. rA   Nr~   )rH   r1   s     r   AddNewPriorityr   a  s)    
B
I
I  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.rt   r]   r(   r=   Nr   ru   s     r   AddTargetResourcesr   m  s-      K  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   ru   s     r   AddTargetServiceAccountsr   x  s-    ! ':  r   c                 &    U R                  SUSS9  g)z"Adds the description of this rule.rC   z.An optional, textual description for the rule.r<   NrL   ru   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  U R                  S
SSSSS9  U R                  SSS9  g)z+Adds the arguments of association creation.r6   Tz&Security policy ID of the association.r<   r@   zvID of the organization in which the firewall policy is to be associated. Must be set if FIREWALL_POLICY is short name.rA   rB   z7ID of the folder with which the association is created.z--replace-association-on-target
store_trueFa  By default, if you attempt to insert an association to an organization or folder resource that is already associated with a firewall 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}".NrL   rM   s    r   AddArgsCreateAssociationr     s    3  
 	G   	P   	'$   	%  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$   NAMEz"Name of the association to delete.)r]   r=   r@   ztID of the organization in which the firewall policy is to be detached. Must be set if FIREWALL_POLICY is short name.rA   NrL   rM   s    r   AddArgsDeleteAssociationr     s<    /   	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.rA   rB   z6ID of the folder with which the association is listed.NrR   rG   s     r   AddArgsListAssociationr     sK    


D

5%I  
 O  r   c                 P    U R                  S[        R                  " 5       SSSS9  g)z)Adds a source address group to this rule.z--src-address-groupsSOURCE_ADDRESS_GROUPSFz\Source address groups to match for this rule. Can only be specified if DIRECTION is ingress.r   Nr   rM   s    r   AddSrcAddressGroupsr     s/     %;  	r   c                 P    U R                  S[        R                  " 5       SSSS9  g)z.Adds a destination address group to this rule.z--dest-address-groupsDEST_ADDRESS_GROUPSFz`Destination address groups to match for this rule. Can only be specified if DIRECTION is egress.r   Nr   rM   s    r   AddDestAddressGroupsr     s/     #:  	r   c                 P    U R                  S[        R                  " 5       SSSS9  g)zAdds source fqdns to this rule.z--src-fqdnsSOURCE_FQDNSFzUSource FQDNs to match for this rule. Can only be specified if DIRECTION is `ingress`.r   Nr   rM   s    r   AddSrcFqdnsr     s/     =  	r   c                 P    U R                  S[        R                  " 5       SSSS9  g)z$Adds destination fqdns to this rule.z--dest-fqdns
DEST_FQDNSFzYDestination FQDNs to match for this rule. Can only be specified if DIRECTION is `egress`.r   Nr   rM   s    r   AddDestFqdnsr      s/     <  	r   c                 l    SnU(       a  US-  nU R                  S[        R                  " 5       SSUS9  g)z'Adds a source region code to this rule.z\Source Region Code to match for this rule. Can only be specified if DIRECTION is `ingress`. z\Cannot be specified when the source network type is NON_INTERNET, VPC_NETWORK or INTRA_VPC. z--src-region-codesSOURCE_REGION_CODESFr   Nr   rH   support_network_scopes	help_texts      r   AddSrcRegionCodesr     sM    "  	<I 	 #  r   c                 l    SnU(       a  US-  nU R                  S[        R                  " 5       SSUS9  g)z,Adds a destination region code to this rule.z`Destination Region Code to match for this rule. Can only be specified if DIRECTION is `egress`. zBCannot be specified when the source network type is NON_INTERNET. z--dest-region-codesDEST_REGION_CODESFr   Nr   r   s      r   AddDestRegionCodesr   "  sK    !  LI 	 !  r   c                 f    SnU(       a  SnU R                  S[        R                  " 5       SSUS9  g)z8Adds source threat intelligence list names to this rule.zSource Threat Intelligence lists to match for this rule. Can only be specified if DIRECTION is `ingress`. The available lists can be found here: https://cloud.google.com/vpc/docs/firewall-policies-rule-details#threat-intelligence-fw-policy.aL  Source Threat Intelligence lists to match for this rule. Can only be specified if DIRECTION is `ingress`. Cannot be specified when the source network type is NON_INTERNET, VPC_NETWORK or INTRA_VPC. The available lists can be found here: https://cloud.google.com/vpc/docs/firewall-policies-rule-details#threat-intelligence-fw-policy.z--src-threat-intelligence SOURCE_THREAT_INTELLIGENCE_LISTSFr   Nr   rH   r   	text_helps      r   AddSrcThreatIntelligencer   5  sJ    h  	j  	! 0  r   c                 f    SnU(       a  SnU R                  S[        R                  " 5       SSUS9  g)z=Adds destination threat intelligence list names to this rule.zDestination Threat Intelligence lists to match for this rule. Can only be specified if DIRECTION is `egress`. The available lists can be found here: https://cloud.google.com/vpc/docs/firewall-policies-rule-details#threat-intelligence-fw-policy.a2  Destination Threat Intelligence lists to match for this rule. Can only be specified if DIRECTION is `egress`. Cannot be specified when source network type is NON_INTERNET. The available lists can be found here: https://cloud.google.com/vpc/docs/firewall-policies-rule-details#threat-intelligence-fw-policy.z--dest-threat-intelligenceDEST_THREAT_INTELLIGENCE_LISTSFr   Nr   r   s      r   AddDestThreatIntelligencer   O  sJ    h  	j  	" .  r   c                 (    U R                  SSSSS9  g))Adds security profile group to this rule.--security-profile-groupSECURITY_PROFILE_GROUPFad  An org-based security profile group to be used with apply_security_profile_group action. Allowed formats are: a) http(s)://<namespace>/<api>/organizations/<org_id>/locations/global/securityProfileGroups/<profile> b) (//)<namespace>/organizations/<org_id>/locations/global/securityProfileGroups/<profile> c) <profile>. In case "c" `gcloud` CLI will create a reference matching format "a", but to make it work CLOUDSDK_API_ENDPOINT_OVERRIDES_NETWORKSECURITY property must be set. In order to set this property, please run the command `gcloud config set api_endpoint_overrides/networksecurity https://<namespace>/`.r]   r(   r=   NrL   rM   s    r   AddSecurityProfileGroupr   h  #     &	$  r   c                 (    U R                  SSSSS9  g)r   r   r   FaN  An org-based security profile group to be used with mirror action. Allowed formats are: a) http(s)://<namespace>/<api>/organizations/<org_id>/locations/global/securityProfileGroups/<profile> b) (//)<namespace>/organizations/<org_id>/locations/global/securityProfileGroups/<profile> c) <profile>. In case "c" `gcloud` CLI will create a reference matching format "a", but to make it work CLOUDSDK_API_ENDPOINT_OVERRIDES_NETWORKSECURITY property must be set. In order to set this property, please run the command `gcloud config set api_endpoint_overrides/networksecurity https://<namespace>/`.r   NrL   rM   s    r    AddMirroringSecurityProfileGroupr   }  r   r   c                 D    U R                  SS[        R                  SS9  g)z6Adds the option to turn on TLS decryption on the rule.z--tls-inspectFzUse this flag to indicate whether TLS traffic should be inspected using the TLS inspection policy when the security profile group is applied. Default: no TLS inspection.r   Nr   rM   s    r   AddTlsInspectr     s)    --4  	r   c                 (    U R                  SUSSS9  g)z'Adds source network scope to this rule.z--src-network-scopeTaE  Deprecated. Use --src-network-type instead. Use this flag to indicate that the rule should match internet, non-internet traffic or traffic coming from the network specified by --src-network. It applies to ingress rules. Valid values are INTERNET, NON_INTERNET, VPC_NETWORKS and INTRA_VPC. Use empty string to clear the field.r(   hiddenr=   NrL   ru   s     r   AddSrcNetworkScoper     s#    (  r   c                 &    U R                  SUSS9  g)z&Adds source network type to this rule.z--src-network-type  Use this flag to indicate that the rule should match internet, non-internet traffic or traffic coming from the network specified by --src-network. It applies to ingress rules. Valid values are INTERNET, NON_INTERNET, VPC_NETWORKS and INTRA_VPC. Use empty string to clear the field.r<   NrL   ru   s     r   AddSrcNetworkTyper     s     (	  
r   c                 &    U R                  SUSS9  g)z)Adds source network context to this rule.z--src-network-contextr   r<   NrL   ru   s     r   AddSrcNetworkContextr     s     (	  
r   c                 P    U R                  S[        R                  " 5       SSSS9  g)z+Adds source network urls list to this rule.z--src-networksSRC_NETWORKSFzThe source VPC networks to  match for this rule.  It can only be specified when --src-network-type is VPC_NETWORKS. It applies to  ingress rules. It accepts full or partial URLs.r   Nr   rM   s    r   AddSrcNetworksr     s/     =  
r   c                 (    U R                  SUSSS9  g)z,Adds destination network scope to this rule.z--dest-network-scopeTa  Deprecated. Use --dest-network-type instead. Use this flag to indicate that the rule should match internet or non-internet traffic. It applies to destination traffic for egress rules. Valid values are INTERNET and NON_INTERNET. Use empty string to clear the field.r   NrL   ru   s     r   AddDestNetworkScoper     s#    .  r   c                 &    U R                  SUSS9  g)z+Adds destination network type to this rule.z--dest-network-typeUse this flag to indicate that the rule should match internet or non-internet traffic. It applies to destination traffic for egress rules. Valid values are INTERNET and NON_INTERNET. Use empty string to clear the field.r<   NrL   ru   s     r   AddDestNetworkTyper     s     .	  	r   c                 &    U R                  SUSS9  g)z.Adds destination network context to this rule.z--dest-network-contextr   r<   NrL   ru   s     r   AddDestNetworkContextr     s     .	  	r   c                 l    SnU(       a  US-  nU R                  S[        R                  " 5       SUUS9  g)z'Adds a  source secure tag to this rule.a  A list of instance secure tags indicating the set of instances on the network to which the rule applies if all other fields match. Either --src-ip-ranges or --src-secure-tags must be specified for ingress traffic. If both --src-ip-ranges and --src-secure-tags are specified, an inbound connection is allowed if either the range of the source matches --src-ip-ranges or the tag of the source matches --src-secure-tags. Secure Tags can be assigned to instances during instance creation.zD Secure tags cannot be specified if source network type is INTERNET.z--src-secure-tagsSOURCE_SECURE_TAGSr   Nr   )rH   r(   r   r   s       r   AddSrcSecureTagsr   
  sK      NI 	 "  r   c                 P    U R                  S[        R                  " 5       SUSS9  g)z&Adds a target secure tag to this rule.z--target-secure-tagsTARGET_SECURE_TAGSzdAn optional, list of target secure tags with a name of the format tagValues/ or full namespaced namer   Nr   ru   s     r   AddTargetSecureTagsr   $  s/     "6  	r   )FFN)FF)F)T)TNri   )?__doc__
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   compute_completersr   r-   DEFAULT_LIST_FORMATListCommandCompleterr
   r2   r4   r7   r:   rJ   rN   rP   rS   rU   rW   r`   rv   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s:   Q &  ' / O E	  2 G G  -1
 $ F" $"	


	(V"(&42**" 4r   