
    8                         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Ze
j                   G d de
j                                Zddde_        y
)zBCommand for replacing the rules of organization firewall policies.    )absolute_import)division)unicode_literals)base_classes)client)base)firewall_policies_utils)flagsNc                   *    e Zd ZdZdZed        Zd Zy)
CloneRulesa  Replace the rules of a Compute Engine organization firewall policy with rules from another policy.

  *{command}* is used to replace the rules of organization firewall policies. An
   organization 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
   FirewallPolicyArgumentFIREWALL_POLICY_ARGAddArgumentAddArgsCloneRules)clsparsers     4lib/surface/compute/firewall_policies/clone_rules.pyArgszCloneRules.Args(   sD    #::!5C ''}'M	F#    c           	         t        j                  | j                               }| j                  j	                  ||j
                  d      }t        j                  ||j                  |j
                  t        j                  | j                               j                               }t        j                  ||j                         |j                        }|j                  d||j                         S )NF)with_project)refcompute_client	resourcesversion)organization)only_generate_request
dest_fp_idsource_firewall_policy)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer   r   OrgFirewallPolicysix	text_typelowerr	   GetFirewallPolicyIdNamer    r   r#   )selfargsholderr   org_firewall_policyr"   s         r   RunzCloneRules.Run0   s    **4+<+<+>?F

"
"
4
4fU 5 C !22}}""d//1288:	 )<<SXXZd6G6GJ ))##:: *  r   )__name__
__module____qualname____doc__r   classmethodr   r1    r   r   r   r      s&     $ $r   r   z    To clone the rules of an organization firewall policy with ID ``123456789",
    from another organization firewall policy with ID ``987654321", run:

      $ {command} 123456789 --source-firewall-policy=987654321
    a       To clone rules to a firewall policy, the user must have the following
    permission: *`compute.firewallPolicies.cloneRules`.

    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)r5   
__future__r   r   r   googlecloudsdk.api_lib.computer   0googlecloudsdk.api_lib.compute.firewall_policiesr   googlecloudsdk.callioper   4googlecloudsdk.command_lib.compute.firewall_policiesr	   r
   r(   DefaultUniverseOnlyUpdateCommandr   detailed_helpr7   r   r   <module>rA      sb    I &  ' 7 C ( X F 
 $## $ $P

 r   