
                            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  SS
KJr  SSKJr  SSKJr  SSKrSrSr\R*                   " S S\R,                  \R.                  5      5       rSSS.\l        g)z@Command for listing the rules of organization firewall policies.    )absolute_import)division)unicode_literals)base_classes)firewalls_utils)lister)client)base)firewall_policies_utils)flags)logNzTo show all fields of the firewall, please show in JSON format: --format=json
To show more fields in table format, please see the examples in --help.
z  table(
    priority,
    direction,
    action,
    match.srcIpRanges.list():label=SRC_RANGES,
    match.destIpRanges.list():label=DEST_RANGES,
    match.layer4Configs.map().org_firewall_rule().list():label=PORT_RANGES
  )c                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)	ListRules/   zList the rules of a Compute Engine organization firewall policy.

*{command}* is used to list the rules of an organization firewall policy.
Nc                     [         R                  " SSS9U l        U R                  R                  USS9  UR	                  SSS9  UR
                  R                  [        5        [        R                  " U5        g )	NTzlist rules for)required	operationget)operation_typez--organizationzmOrganization which the organization firewall policy belongs to. Must be set if FIREWALL_POLICY is short name.)help)
r   FirewallPolicyArgumentFIREWALL_POLICY_ARGAddArgumentadd_argumentdisplay_info	AddFormatDEFAULT_LIST_FORMATr   AddBaseListerArgs)clsparsers     3lib/surface/compute/firewall_policies/list_rules.pyArgsListRules.Args:   su    #::!13C''u'E
>  @ !!"56
V$    c           	      .   [         R                  " U R                  5       5      nU R                  R	                  XR
                  SS9n[        R                  " UUR                  UR
                  [        R                  " U R                  5       5      R                  5       S9n[        R                  " XCR                  5       UR                  S9nUR                  USS9nU(       d  g [         R"                  " UR                  US   R$                  5      $ )NF)with_project)refcompute_client	resourcesversion)organization)fp_idonly_generate_requestr   )r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer)   r	   OrgFirewallPolicysix	text_typelowerr   GetFirewallPolicyIdNamer+   Describer   SortFirewallPolicyRulesrules)selfargsholderr'   org_firewall_policyr,   responses          r!   RunListRules.RunF   s    **4+<+<+>?F

"
"
4
4U 5 4C 22}}""d//1288:	<
 $77XXZd6G6GIE"++5 , 2H226==3;A;3D3DF Fr$   c                 R    A[         R                  R                  S[        -   5        g )N
)r   statusPrintLIST_NOTICE)r:   resources_were_displayeds     r!   EpilogListRules.EpilogX   s     JJTK'(r$    )__name__
__module____qualname____firstlineno____doc__r   classmethodr"   r?   rG   __static_attributes__rI   r$   r!   r   r   /   s,    
 	% 	%F$)r$   r   a      To list the rules of an organization firewall policy with ID
    ``123456789", run:

      $ {command} 123456789

    To list all the fields of the rules of an organization firewall policy with
    ID ``123456789", run:

      $ {command} 123456789 --format="table(
        priority,
        action,
        direction,
        match.srcIpRanges.list():label=SRC_RANGES,
        match.destIpRanges.list():label=DEST_RANGES,
        match.layer4Configs.map().org_firewall_rule().list():label=PORT_RANGES,
        targetServiceAccounts.list():label=TARGET_SVC_ACCT,
        targetResources:label=TARGET_RESOURCES,
        ruleTupleCount,
        enableLogging,
        description)"
        a      To list rules of a firewall policy, the user must have the following
    permission: *`compute.firewallPolicies.get`.

    To find predefined roles that contain those permissions, see the [Compute
    Engine IAM roles](https://cloud.google.com/compute/docs/access/iam).
    )EXAMPLESzIAM PERMISSIONS)rN   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r   0googlecloudsdk.api_lib.compute.firewall_policiesr	   googlecloudsdk.callioper
   4googlecloudsdk.command_lib.compute.firewall_policiesr   r   googlecloudsdk.corer   r2   rE   r   DefaultUniverseOnlyDescribeCommandListCommandr   detailed_helprI   r$   r!   <module>r\      s    G &  ' 7 : 1 C ( X F # 

  ()$$d&6&6 () ()Z	,1	 r$   