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

*{command}* is used to create organization security policy associations. An
organization security policy is a set of rules that controls access to various
resources.

This command has billing implications. Projects in the hierarchy with
effective hierarchical security policies will be automatically enrolled into
Cloud Armor Enterprise if not already enrolled.
c                     [         R                  " U5        UR                  R                  [         R                  5        g )N)r	   AddArgsCreateAssociationdisplay_infoAddCacheUpdaterOrgSecurityPoliciesCompleter)clsparsers     @lib/surface/compute/org_security_policies/associations/create.pyArgsCreate.Args0   s*    	""6*
''(J(JK    c                    [         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/ n/ nUR                  S5      (       a  UR                  nUR                  S5      (       a!  SUR                  -   nUc  SUR                  -   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         UR                  S5      (       a  UR$                  nUR                  S5      (       a  UR&                  nUR(                  (       a  SnUR                  R*                  R-                  UUUUS9n	[        R.                  R1                  S5        [2        R4                  " UUR6                  UR                  S9n
UR9                  U	U
USS9$ )N)compute_client	resourcesversionFnameproject_numberz	projects/zproject-folderzfolders/zfolder-organizationzorganizations/zorganization-zkMust specify attachment ID with --organization=ORGANIZATION or --folder=FOLDER or --project-number=PROJECT.excluded_projectsexcluded_foldersT)attachmentIdr   excludedProjectsexcludedFoldersz  This command has billing implications. Projects in the hierarchy with
  effective organization security policies will be automatically enrolled into
  Cloud Armor Enterprise if not already enrolled.)r!   )associationsecurity_policy_idreplace_existing_associationonly_generate_request)r   ComputeApiHolderReleaseTrackr   OrgSecurityPolicyr   six	text_typelowerIsSpecifiedr   r   r    r!   r   errorsysexitr"   r#   replace_association_on_targetmessagesSecurityPolicyAssociationstatusPrintr
   GetSecurityPolicyIdsecurity_policyAddAssociation)selfargsholderorg_security_policyr   attachment_idr)   r"   r#   r'   r(   s              r   Run
Create.Run5   s6   **4+<+<+>?F 22}}""d//1288:<
 DM#( YYd())!D$7$77m	D///!! 4;;.m	4;;&''M,A&):)::m	!2!22	ii9: 
hhj+,,00*++..))%)"--((BB"*(	 C K JJ 5 6 5HH&&( ---%A#	 . % %r    N)	__name__
__module____qualname____firstlineno____doc__classmethodr   rB   __static_attributes__rD   r   r   r   r       s#    
	 L LA%r   r   EXAMPLESz    To associate an organization security policy under folder with ID
    ``123456789'' to folder ``987654321'', run:

      $ {command} --security-policy=123456789 --folder=987654321
    )rI   
__future__r   r   r   r3   googlecloudsdk.api_lib.computer   4googlecloudsdk.api_lib.compute.org_security_policiesr   googlecloudsdk.callioper   8googlecloudsdk.command_lib.compute.org_security_policiesr	   r
   googlecloudsdk.corer   r.   UniverseCompatibleReleaseTracksr,   ALPHABETAGACreateCommandr   detailed_helprD   r   r   <module>rZ      s    F &  ' 
 7 G ( J ` # 
 T..33T5F5F5I5IR%T R% R%l 	 r   