
                         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 update 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)	Update   zDUpdate the policy on the given attachment point with the given name.EXAMPLESaP            The following command updates the IAM policy ``my-deny-policy'', which
          is attached to the resource project ``123'' and has the etag ``abc'':

            $ {command} my-deny-policy --attachment-point=cloudresourcemanager.googleapis.com/projects/123 --kind=denypolicies --policy-file=policy.json --etag=abc
          c                 l   [         R                  " 5       R                  U 5        [         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GetEtagFlag)parsers    "lib/surface/iam/policies/update.pyArgsUpdate.Args-   su    	  "..v6	##F+	''/	))&1	##F+    c                 z   UR                   R                  5       n[        R                  " U5      n[        R                  " U5      nUR
                  R                  SS5      nSSSS.nU[        R                  R                  :X  a,  [        R                  " UR                  UR                  5      nOuU[        R                  R                  :X  a,  [        R                  " UR                  UR                  5      nO+[        R                  " UR                  UR                  5      nSR                  XQR                   UR"                  5      Ul        UR&                  nUc  UR&                  nXl        UR(                  R+                  U5      n	[,        R.                  " U	R$                  XaR                      SS	9  U	$ )
N/z%2F
denyPolicyprincipalAccessBoundaryPolicyaccessboundaryPolicy)denypoliciesprincipalaccessboundarypoliciesaccessboundarypolicieszpolicies/{}/{}/{}T)is_async)calliope_commandReleaseTrackapisGetClientInstanceGetMessagesModuleattachment_pointreplacer   ALPHAParseYamlOrJsonPolicyFilepolicy_fileGoogleIamV2alphaPolicyBETAGoogleIamV2betaPolicyGoogleIamV2Policyformatkind	policy_idnameetagr   r   r	   UpdatedResource)
selfargsrelease_trackclientmessagesr)   kindspolicyr6   results
             r   Run
Update.Run5   si   ))668M##M2F%%m4H,,44S%@ %+J"8E ))///--d.>.>.6.M.MOf	$++00	0--d.>.>.6.L.LNf --d.>.>.6.H.HJf &,,-=yy-1^^=FK 99D|[[dK__##F+FU99%5EMr    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr   r@   __static_attributes__rB   r   r   r   r      s>     M 
//  - , ,"r   r   )rG   
__future__r   r   r   rH   googlecloudsdk.api_lib.iamr   r&   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   r   googlecloudsdk.corer	   UniverseCompatibleReleaseTracksr%   r+   r/   GAUpdateCommandr   rB   r   r   <module>rV      s    @ &  '  7 ( B # D%%++T->->-C-C%%((*7T 7* 7r   