
    )	                     ,   S 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Jr  \R                  " \R                  R                  \R                  R                   \R                  R"                  5       " S	 S
\R$                  5      5       rg)z'Command to set IAM policy for a folder.    )absolute_import)division)unicode_literals)folders)base)iam_util)flagsc                   .    \ rS rSrSr\S 5       rS rSrg)SetIamPolicy   aI  Set IAM policy for a folder.

Sets the IAM policy for a folder, given a folder ID and a file encoded in
JSON or YAML that contains the IAM policy.

## EXAMPLES

The following command reads an IAM policy defined in a JSON file `policy.json`
and sets it for a folder with the ID `3589215982`:

  $ {command} 3589215982 policy.json
c                 n    [         R                  " S5      R                  U 5        U R                  SSS9  g )Nzwhose policy you want to set.policy_filez&JSON or YAML file with the IAM policy.)help)r	   FolderIdArgAddToParseradd_argument)parsers    6lib/surface/resource_manager/folders/set_iam_policy.pyArgsSetIamPolicy.Args+   s6    	56BB6J
D  F    c                 d   [         R                  " 5       n[        R                  " UR                  UR
                  5      u  p4[        R                  Ul        SU;  a  US-  nSU;  a  US-  n[         R                  " UR                  X45      n[        R                  " UR                  S5        U$ )Nbindingsz	,bindingsetagz,etagfolder)r   FoldersMessagesr   ParsePolicyFileWithUpdateMaskr   Policy!MAX_LIBRARY_IAM_SUPPORTED_VERSIONversionr   idLogSetIamPolicy)selfargsmessagespolicyupdate_maskresults         r   RunSetIamPolicy.Run1   s    &&(H"@@(//+F??FN $[ k[ Wk!!$''6?FTWWh/Mr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r)   __static_attributes__r+   r   r   r   r      s"     F F
r   r   N)r0   
__future__r   r   r   'googlecloudsdk.api_lib.resource_managerr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   +googlecloudsdk.command_lib.resource_managerr	   ReleaseTracksReleaseTrackALPHABETAGACommandr   r+   r   r   <module>r>      st    . &  ' ; ( 3 = D%%++T->->-C-C%%((*#4<< #*#r   