
    q                         d Z ddlmZ ddlmZ ddlmZ ddl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)z2Command for moving organization firewall policies.    )absolute_import)division)unicode_literalsN)base_classes)client)base)firewall_policies_utils)flags)logc                   *    e Zd ZdZdZed        Zd Zy)MovezMove a Compute Engine organization firewall policy.

  *{command}* is used to move is used to move organization firewall policies to
  new parent nodes.
  Nc                     t        j                  dd      | _        | j                  j                  |d       t        j                  |       y )NTmove)required	operation)operation_type)r
   FirewallPolicyArgumentFIREWALL_POLICY_ARGAddArgumentAddArgsMove)clsparsers     -lib/surface/compute/firewall_policies/move.pyArgsz	Move.Args+   sA    #::)C''v'F	f    c           	         t        j                  | j                               }| j                  j	                  ||j
                  d      }t        j                  ||j                  |j
                  t        j                  | j                               j                               }d }|j                  d      rd|j                  z   }|j                  d      rd|j                  z   }|)t        j                  d       t!        j"                          t%        j&                  ||j)                         |j                  	      }|j+                  d||
      S )NF)with_project)refcompute_client	resourcesversionorganizationzorganizations/folderzfolders/zIMust specify parent id with --organization=ORGANIZATION or--folder=FOLDER)r"   )only_generate_requestfp_id	parent_id)r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer    r   OrgFirewallPolicysix	text_typelowerIsSpecifiedr"   r#   r   errorsysexitr	   GetFirewallPolicyIdNamer   )selfargsholderr   org_firewall_policyr&   r%   s          r   RunzMove.Run2   s+   **4+<+<+>?F

"
"
4
4fU 5 4C 22}}""d//1288:	< I'"T%6%66i!t{{*i	ii " #	hhj#77SXXZd6G6GIE###5I $ G Gr   )__name__
__module____qualname____doc__r   classmethodr   r8    r   r   r   r      s'      Gr   r   z    To move an organization firewall policy under folder with ID ``123456789" to
    folder ``987654321", run:

      $ {command} 123456789 --folder=987654321
    a      To move a firewall policy, the user must have the following
    permission: *`compute.firewallPolicies.move`.

    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)r<   
__future__r   r   r   r0   googlecloudsdk.api_lib.computer   0googlecloudsdk.api_lib.compute.firewall_policiesr   googlecloudsdk.callioper   4googlecloudsdk.command_lib.compute.firewall_policiesr	   r
   googlecloudsdk.corer   r+   DefaultUniverseOnlyUpdateCommandr   detailed_helpr>   r   r   <module>rI      sh    9 &  ' 
 7 C ( X F # 
&G4 &G &GV	 r   