
    +                     R   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  \
R                   \
R"                  " \
R$                  R&                  \
R$                  R(                  \
R$                  R*                  5       " S
 S\
R,                  5      5       5       rg)z9Command to create a policy on the given attachment point.    )absolute_import)division)unicode_literalsN)policies)base)policies_flags)logc                   V    \ rS rSrSrS\R                  " S5      0r\S 5       r	S r
Srg)	Create   zBCreate 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                 $   [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R
                  " 5       R                  U 5        g )N)flagsGetAttachmentPointFlagAddToParserGetKindFlagGetPolicyIDFlagGetPolicyFileFlag)parsers    "lib/surface/iam/policies/create.pyArgsCreate.Args/   s^    	  "..v6	##F+	''/	))&1    c           
      p   UR                   R                  5       n[        R                  " U5      n[        R                  " U5      nSSSS.nUR
                  R                  SS5      nU[        R                  R                  :X  ax  UR                  R                  UR                  SR                  XaR                  5      UR                  [        R                  " UR                   UR"                  5      S95      nGOU[        R                  R$                  :X  aw  UR                  R                  UR                  SR                  XaR                  5      UR                  [        R                  " UR                   UR&                  5      S	95      nOvUR                  R                  UR                  SR                  XaR                  5      UR                  [        R                  " UR                   UR(                  5      S
95      n[*        R,                  " UR.                  XQR                     SS9  U$ )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   Run
Create.Run6   s   ))668M##M2F%%m4H$+J"8E
 ,,44S%@))///++

1
1%,,-=yyI~~%)%C%C""H$C$C&E 2 FGf 
$++00	0++

1
1%,,-=yyI~~$($B$B""H$B$B%D 2 EFf ++

1
1%,,-=yyI~~ $ > >""H$>$>!@ 2 ABf U99%5EMr    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr   rD   __static_attributes__rF   r   r   r   r      s>     K 
//  
- 2 2"r   r   )rK   
__future__r   r   r   rL   googlecloudsdk.api_lib.iamr   r*   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   r   googlecloudsdk.corer	   UniverseCompatibleReleaseTracksr)   r/   r8   GACreateCommandr   rF   r   r   <module>rZ      s    @ &  '  7 ( B # D%%++T->->-C-C%%((*8T 8* 8r   