
                             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r " S S\R$                  5      rSS0\l        g)z?Command for creating organization firewall policy associations.    )absolute_import)division)unicode_literalsN)base_classes)client)base)firewall_policies_utils)flags)logc                   .    \ rS rSrSr\S 5       rS rSrg)Create    a  Create a new association between a firewall policy and an organization or folder resource.

*{command}* is used to create organization firewall policy associations. An
organization firewall policy is a set of rules that controls access to various
resources.
c                     [         R                  " U5        UR                  R                  [         R                  5        g )N)r
   AddArgsCreateAssociationdisplay_infoAddCacheUpdaterFirewallPoliciesCompleter)clsparsers     <lib/surface/compute/firewall_policies/associations/create.pyArgsCreate.Args(   s*    	""6*
''(G(GH    c                 x   [         R                  " U R                  5       5      n[        R                  " UR                  UR
                  [        R                  " U R                  5       5      R                  5       S9nS nS nSnUR                  S5      (       a  UR                  nS nUR                  S5      (       a!  SUR                  -   nUc  SUR                  -   nUR                  S5      (       a$  Uc!  SUR                  -   nUc  S	UR                  -   nUc+  [        R                  " S
5        [        R                   " 5         SnUR"                  (       a  SnUR                  R$                  R'                  XTS9n[(        R*                  " UUR,                  UR                  S9nUR/                  UUUSS9$ )N)compute_client	resourcesversionFnamefolderzfolders/zfolder-organizationzorganizations/zorganization-zRMust specify attachment target with --organization=ORGANIZATION or --folder=FOLDERT)attachmentTargetr   )r    )associationfirewall_policy_idreplace_existing_associationonly_generate_request)r   ComputeApiHolderReleaseTrackr   OrgFirewallPolicyr   six	text_typelowerIsSpecifiedr   r   r    r   errorsysexitreplace_association_on_targetmessagesFirewallPolicyAssociationr	   GetFirewallPolicyIdfirewall_policyAddAssociation)	selfargsholderorg_firewall_policyr   attachment_targetr$   r"   r#   s	            r   Run
Create.Run-   s   **4+<+<+>?F 22}}""d//1288:<
 D#( YYd!!$t{{2	4;;&'',=,E*T->->>	!2!22 	ii 
hhj#( ))%)"--((BB* C 7K 1DD&&( ---%A#	 . % %r    N)	__name__
__module____qualname____firstlineno____doc__classmethodr   r;   __static_attributes__r=   r   r   r   r       s"     I I.%r   r   EXAMPLESz    To associate an organization firewall policy under folder with ID
    ``123456789" to folder ``987654321", run:

      $ {command} --firewall-policy=123456789 --folder=987654321
    )rB   
__future__r   r   r   r.   googlecloudsdk.api_lib.computer   0googlecloudsdk.api_lib.compute.firewall_policiesr   googlecloudsdk.callioper   4googlecloudsdk.command_lib.compute.firewall_policiesr	   r
   googlecloudsdk.corer   r)   CreateCommandr   detailed_helpr=   r   r   <module>rN      sS    F &  ' 
 7 C ( X F # 
;%T ;%~ 	 r   