
    D                     F   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                   e
j                   e
j"                  j$                  e
j"                  j&                         G d de
j(                                      Zddie_        y
)z<Command for replace rules of organization security policies.    )absolute_import)division)unicode_literals)base_classes)client)base)flags)org_security_policies_utilsNc                   *    e Zd ZdZdZed        Zd Zy)	CopyRulesa  Replace the rules of a Compute Engine organization security policy with rules from another policy.

  *{command}* is used to replace the rules of organization security policies. An
   organization security policy is a set of rules that controls access to
   various resources.
  Nc                     t        j                  dd      | _        | j                  j                  |d       t        j                  |       y )NTzcopy the rules to)required	operationz
copy-rules)operation_type)r	   OrgSecurityPolicyArgumentORG_SECURITY_POLICY_ARGAddArgumentAddArgsCopyRules)clsparsers     7lib/surface/compute/org_security_policies/copy_rules.pyArgszCopyRules.Args)   sB    "'"A"A!4#6C++F<+P	6"    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_sp_idsource_security_policy)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer   r   OrgSecurityPolicysix	text_typelowerr
   GetSecurityPolicyIdNamer    r   r#   )selfargsholderr   org_security_policyr"   s         r   RunzCopyRules.Run0   s    **4+<+<+>?F

&
&
8
8fU 9 4C 22}}""d//1288:	<
 -@@SXXZd6G6GIJ((##:: ) < <r   )__name__
__module____qualname____doc__r   classmethodr   r1    r   r   r   r      s&     !# #<r   r   EXAMPLESz    To copy the rules of an organization security policy with ID ``123456789'',
    from another organization security policy with ID ``987654321'', run:

      $ {command} 123456789 --source-security-policy=987654321
    )r5   
__future__r   r   r   googlecloudsdk.api_lib.computer   4googlecloudsdk.api_lib.compute.org_security_policiesr   googlecloudsdk.callioper   8googlecloudsdk.command_lib.compute.org_security_policiesr	   r
   r(   UniverseCompatibleReleaseTracksr%   ALPHABETAUpdateCommandr   detailed_helpr7   r   r   <module>rD      s    C &  ' 7 G ( J ` 
 D%%++T->->-C-CD<"" < E <F 		 r   