
    +                     R   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 e
j                    e
j"                  e
j$                  j&                  e
j$                  j(                  e
j$                  j*                         G d
 de
j,                                      Zy)z9Command to create a policy on the given attachment point.    )absolute_import)division)unicode_literalsN)policies)base)policies_flags)logc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)CreatezBCreate a policy on the given attachment point with the given name.EXAMPLESaj            The following command creates the IAM policy defined at the resource
          project ``123'' of kind ``denypolicies'' and id ``my-deny-policy'' from the
          file ``policy.json'':


            $ {command} my-deny-policy --attachment-point=cloudresourcemanager.googleapis.com/projects/123 --kind=denypolicies --policy-file=policy.json
          c                    t        j                         j                  |        t        j                         j                  |        t        j                         j                  |        t        j
                         j                  |        y )N)flagsGetAttachmentPointFlagAddToParserGetKindFlagGetPolicyIDFlagGetPolicyFileFlag)parsers    "lib/surface/iam/policies/create.pyArgszCreate.Args/   s^    	  "..v6	##F+	''/	))&1    c           
         |j                   j                         }t        j                  |      }t        j                  |      }dddd}|j
                  j                  dd      }|t        j                  j                  k(  r{|j                  j                  |j                  dj                  ||j                        |j                  t        j                  |j                   |j"                                    }n|t        j                  j$                  k(  rz|j                  j                  |j                  dj                  ||j                        |j                  t        j                  |j                   |j&                        	            }ny|j                  j                  |j                  dj                  ||j                        |j                  t        j                  |j                   |j(                        
            }t+        j,                  |j.                  ||j                     d       |S )N
denyPolicyprincipalAccessBoundaryPolicyaccessboundaryPolicy)denypoliciesprincipalaccessboundarypoliciesaccessboundarypolicies/z%2Fzpolicies/{}/{})parentpolicyIdgoogleIamV2alphaPolicy)r    r!   googleIamV2betaPolicy)r    r!   googleIamV2PolicyT)is_async)calliope_commandReleaseTrackapisGetClientInstanceGetMessagesModuleattachment_pointreplacer   ALPHAr   CreatePolicyIamPoliciesCreatePolicyRequestformatkind	policy_idParseYamlOrJsonPolicyFilepolicy_fileGoogleIamV2alphaPolicyBETAGoogleIamV2betaPolicyGoogleIamV2Policyr	   CreatedResourcename)selfargsrelease_trackclientmessageskindsr+   results           r   Runz
Create.Run6   s   ))668M##M2F%%m4H$+J"8E
 ,,44S%@))///++

1
1%,,-=tyyI~~%)%C%C""H$C$C&E 2 FGf 
$++00	0++

1
1%,,-=tyyI~~$($B$B""H$B$B%D 2 EFf ++

1
1%,,-=tyyI~~ $ > >""H$>$>!@ 2 ABf U499%5EMr   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   rB    r   r   r   r      s@     K 
(//  
- 2 2"r   r   )rF   
__future__r   r   r   rG   googlecloudsdk.api_lib.iamr   r(   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   r   googlecloudsdk.corer	   UniverseCompatibleReleaseTracksr'   r-   r6   GACreateCommandr   rK   r   r   <module>rU      s    @ &  '  7 ( B # D%%++T->->-C-C%%((*8T 8* 8r   