
                            S r SSKJr  SSKJr  SSKJr  SSK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SS.r\R,                  \R.                  " \R0                  R2                  \R0                  R4                  \R0                  R6                  5       " S S\R8                  5      5       5       rg)z%Export firewall policy rules command.    )absolute_import)division)unicode_literalsN)base_classes)client)base)firewall_policies_utils)flags)util)fileszG        Exports Firewall Policy rules configuration to a file.
        z        Firewall Policy rules can be exported by running:

          $ {command} FIREWALL_POLICY --destination=<path-to-file>
            --organization=<organization>
        )DESCRIPTIONEXAMPLESc                   Z    \ rS rSrSrSr\r\S 5       r	\S	S j5       r
\S 5       rS rSrg)
Export,   zExport Compute Engine organization firewall policy rules.

Exports organization firewall policy rules configuration to a file.
This configuration can be imported at a later time.
Nc                     U R                  5       [        R                   R                  :X  a  gU R                  5       [        R                   R                  :X  a  gg)z3Returns the API version based on the release track.alphabetav1)ReleaseTrackr   ALPHABETA)clss    5lib/surface/compute/firewall_policies/export_rules.pyGetApiVersionExport.GetApiVersion:   sG     T..444				t0055	5    c                 L    [         R                  " SU R                  5       SUS9$ )z!Returns the resource schema path.computeFirewallPolicyfor_help)export_utilGetSchemaPathr   )r   r"   s     r   r$   Export.GetSchemaPathC   s,     $$	 r   c                     [         R                  " SSS9U l        U R                  R                  USS9  UR	                  SSS9  [
        R                  " XR                  SS	95        g )
NTzexport rules from)required	operationzexport-rules)operation_typez--organizationzwOrganization in which the organization firewall policy rules export from. Must be set if FIREWALL_POLICY is short name.)helpr!   )r
   FirewallPolicyArgumentFIREWALL_POLICY_ARGAddArgumentadd_argumentr#   AddExportFlagsr$   )r   parsers     r   ArgsExport.ArgsM   sp    #::!4C ''~'N
J   v'8'8$'8'GHr   c           	      j   [         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                  " UUR                  5       UR                  S9nUR                  USS9S   nUR                  R                   R#                  UR$                  S9nUR&                  (       aN  [(        R*                  " UR&                  5       n[,        R.                  " UUU R1                  5       S9  S S S 5        g [,        R.                  " U[2        R4                  U R1                  5       S9  g ! , (       d  f       g = f)	NF)with_project)refcompute_client	resourcesversion)organization)fp_idonly_generate_requestr   )rules)messagestreamschema_path)r   ComputeApiHolderr   r,   ResolveAsResourcer7   r   OrgFirewallPolicysix	text_typelowerr	   GetFirewallPolicyIdNamer9   Describemessagesr    r<   destinationr   
FileWriterr#   r   r$   sysstdout)	selfargsholderfirewall_policy_reforg_firewall_policyr:   firewall_policyfirewall_policy_rulesr>   s	            r   Run
Export.Run\   sy   **4+<+<+>?F22DDU E  !22}}""d//1288:	 $77  "&&E *225 3 	O
 #MM22AA## B  D,,-)**,	
 .- '((* .-s   %F$$
F2 )F)__name__
__module____qualname____firstlineno____doc__r,   DETAILED_HELPdetailed_helpclassmethodr   r$   r1   rU   __static_attributes__rW   r   r   r   r   ,   sU    
 -    I I'r   r   )r\   
__future__r   r   r   rL   googlecloudsdk.api_lib.computer   0googlecloudsdk.api_lib.compute.firewall_policiesr   googlecloudsdk.callioper   4googlecloudsdk.command_lib.compute.firewall_policiesr	   r
   !googlecloudsdk.command_lib.exportr   r#   googlecloudsdk.core.utilr   rC   r]   DefaultUniverseOnlyReleaseTracksr   r   r   GACommandr   rW   r   r   <module>rl      s    , &  ' 
 7 C ( X F A * 
	
 T..33T5F5F5I5IST\\ S Sr   