
                         ~   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  \	R                  \	R                   " \	R"                  R$                  \	R"                  R&                  \	R"                  R(                  5       " S
 S\	R*                  \	R,                  5      5       5       rSS0\l        g)zNCommand for get_effective_firewalls of network with network firewall policies.    )absolute_import)division)unicode_literals)base_classes)firewalls_utils)base)flags)
propertiesc                   .    \ rS rSrSr\S 5       rS rSrg)GetEffectiveFirewalls   a  Get the effective firewalls for a network.

*{command}* is used to get the effective firewalls applied to the network,
including regional firewalls in a specified region.

## EXAMPLES

To get the effective firewalls for a network, run:

  $ {command} --network=network-a --region=us-central1

gets the effective firewalls applied on the network network-a, including
organization firewall policies, global network firewall policies, and regional
network firewall policies in region us-central1.
c                     U R                  SSSS9  U R                  SSS9  U R                  R                  [        R                  5        g )Nz	--networkTz/The network to get the effective firewalls for.)requiredhelpz--regionz3The region to get the effective regional firewalls.)r   )add_argumentdisplay_info	AddFormatr   EFFECTIVE_FIREWALL_LIST_FORMAT)parsers    Hlib/surface/compute/network_firewall_policies/get_effective_firewalls.pyArgsGetEffectiveFirewalls.Args1   sX    
>  
 N   !!66    c           	      b   [         R                  " U R                  5       5      nUR                  nUR                  R                  n[        US5      (       a  UR                  (       a  UR                  nO2[        R                  R                  R                  R                  5       n[        US5      (       a  UR                  (       a  UR                  nO2[        R                  R                  R                  R                  5       n[        R                  " S S9R                  XR                   5      nU(       a  UR#                  5       OS nUR%                  XVUS9n	UR'                  UR(                  R*                  SU	4/5      n
U
S   n/ n/ n[        US5      (       a   [,        R.                  " X;R0                  5      n[        US5      (       a  UR2                  (       a  / nUR2                   H  n[,        R4                  " X?R6                  5      n[,        R4                  " X?R8                  5      nUR                  R;                  UR<                  UUUR>                  UR@                  S	9nURC                  U5        M     [,        RD                  " X>5      nURG                  S
5      (       a)  URH                  S:X  a  UR                  RK                  XS9$ / nU H(  nURM                  [,        RN                  " X?5      5        M*     URM                  [,        RP                  " U5      5        U$ )Nprojectregion)
short_help)r   r   networkr   r   	firewallsfirewallPolicys)namerulespacketMirroringRulestypepriorityformatjson)r   r    ))r   ComputeApiHolderReleaseTrackclientmessageshasattrr   r
   VALUEScore	GetOrFailr   computenetwork_flagsNetworkArgumentForOtherResourceResolveAsResource	resourcesSelfLink@ComputeRegionNetworkFirewallPoliciesGetEffectiveFirewallsRequestMakeRequestsapitools_clientregionNetworkFirewallPoliciesr   SortNetworkFirewallRulesr   r    SortFirewallPolicyRulesr"   r#   QRegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicyr!   r$   r%   appendSortFirewallPoliciesIsSpecifiedr&   :RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseextend,ConvertFirewallPolicyRulesToEffectiveFwRules-ConvertNetworkFirewallRulesToEffectiveFwRules)selfargsholderr*   r+   r   r   r   network_refrequest	responsesresnetwork_firewallall_firewall_policyall_unsorted_firewall_policyfpfirewall_policy_rulepacket_mirroring_rulesfp_responseresults                       r   RunGetEffectiveFirewalls.Run?   s   **4+<+<+>?F]]F}}%%HtYDLLg!!&&..88:gtX4;;{{f  ((//99;f;;../  )0'""$TKWW X G ##<<& % I
 A,CsK  (AA
-- s%&&3+>+>%'"##".FFHH 
 "1!H!H++"
 ooww&!7[[ x 
 	%++K8 $ ,@@
 !!dkkV&;__WW$ X   F!mm

F
F " MMEE	

 Mr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rS   __static_attributes__rU   r   r   r   r      s!    
   Lr   r   EXAMPLESa      To get the effective firewalls of network with name ``example-network'',
    including effective regional firewalls for that network, in region
    ``region-a'', run:

      $ {command} --network=example-network --region=region-a

    To show all fields of the firewall rules, please show in JSON format with
    option --format=json

    To list more the fields of the rules of network ``example-network'' in table
    format, run:

      $ {command} --network=example-network --region=region-a --format="table(
        type,
        firewall_policy_name,
        rule_type,
        priority,
        action,
        direction,
        ip_ranges.list():label=IP_RANGES,
        target_svc_acct,
        enableLogging,
        description,
        name,
        disabled,
        target_tags,
        src_svc_acct,
        src_tags,
        ruleTupleCount,
        targetResources:label=TARGET_RESOURCES)" N)rZ   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   +googlecloudsdk.command_lib.compute.networksr	   r1   googlecloudsdk.corer
   DefaultUniverseOnlyReleaseTracksr)   GABETAALPHADescribeCommandListCommandr   detailed_helprU   r   r   <module>rk      s    U &  ' 7 : ( N * $++00$2C2C2I2IkD00$2B2B k k^  5 '  #r   