
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ dd
lmZ  G d dej"                        Zddie_        y)zBCommand for replacing the rules of organization firewall policies.    )absolute_import)division)unicode_literals)base_classes)client)region_client)base)scope)flagsc                   *    e Zd ZdZdZed        Zd Zy)
CloneRulesa  Replace the rules of a Compute Engine network firewall policy with rules from another policy.

  *{command}* is used to replace the rules of network firewall policies. A
   network firewall policy is a set of rules that controls access to
   various resources.
  Nc                     t        j                  dd      | _        | j                  j                  |d       t        j                  |       y )NTzclone the rules to)required	operationzclone-rules)operation_type)r   NetworkFirewallPolicyArgumentNETWORK_FIREWALL_POLICY_ARGAddArgumentAddArgsCloneRules)clsparsers     <lib/surface/compute/network_firewall_policies/clone_rules.pyArgszCloneRules.Args'   sG    &+&I&I!5'7C###//} 0 .	F#    c                 :   t        j                  | j                               }| j                  j	                  ||j
                        }t        j                  j                  }t        j                  ||j                        }t        |d      r;t        j                  ||j                        }t        j                  j                  }t        j                          j	                  ||j
                  |      }|j#                  |j%                         d      S )N)compute_clientregion)default_scopeF)source_firewall_policyonly_generate_request)r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcescompute_scope	ScopeEnumGLOBALr   NetworkFirewallPolicyhasattrr   RegionNetworkFirewallPolicyREGIONr   $NetworkSrcFirewallPolicyRuleArgumentr   SelfLink)selfargsholderrefr
   network_firewall_policysrc_firewall_policy_refs          r   RunzCloneRules.Run/   s    **4+<+<+>?F

*
*
<
<f C##**E$::FMM+sH - I I
fmm!-%%,,e#HH fe  5  #--6??A# . % %r   )__name__
__module____qualname____doc__r   classmethodr   r4    r   r   r   r      s&     !%$ $%r   r   EXAMPLESa0      To clone the rules of a global network firewall policy with NAME
    ``my-policy'',
    from another network firewall policy with NAME
    ``source-policy'', run:

      $ {command} my-policy --source-firewall-policy=source-policy --global

    To clone the rules of a region network firewall policy with NAME
    ``my-region-policy'', in region ``region-a'',
    from another network firewall policy with NAME
    ``source-policy'', run:

      $ {command} my-region-policy           --source-firewall-policy=source-policy           --region=region-a
    N)r8   
__future__r   r   r   googlecloudsdk.api_lib.computer   8googlecloudsdk.api_lib.compute.network_firewall_policiesr   r   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r%   <googlecloudsdk.command_lib.compute.network_firewall_policiesr   UpdateCommandr   detailed_helpr:   r   r   <module>rD      sM    I &  ' 7 K R ( E N$%## $%N 	
 r   