
                            d Z ddlmZ ddlmZ ddlmZ ddlm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                   j"                  ej                   j$                         G d
 dej&                               Zy)z)Command to set IAM policy for a resource.    )absolute_import)division)unicode_literals)projects_api)base)iam_util)flags)utilc                   &    e Zd ZdZed        Zd Zy)SetIamPolicyao  Set IAM policy for a project.

  Sets the IAM policy for a project, given a project 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 project with the ID `example-project-id-1`:

    $ {command} example-project-id-1 policy.json
  c                 v    t        j                  d      j                  |        t        j                  |        y )Nzset IAM policy for)r	   GetProjectIDNumberFlagAddToParserr   AddArgForPolicyFile)parsers    &lib/surface/projects/set_iam_policy.pyArgszSetIamPolicy.Args+   s*    	  !56BB6J  (    c                     t        j                  |j                        }t        j                  ||j
                        }t        j                  |j                         d       |S )Nproject)	command_lib_utilParseProjectidr   SetIamPolicyFromFilepolicy_filer   LogSetIamPolicyName)selfargsproject_refresultss       r   RunzSetIamPolicy.Run0   sL    "//8K//T=M=MNG[--/;Nr   N)__name__
__module____qualname____doc__staticmethodr   r"    r   r   r   r      s      ) )r   r   N)r&   
__future__r   r   r   +googlecloudsdk.api_lib.cloudresourcemanagerr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   #googlecloudsdk.command_lib.projectsr	   r
   r   ReleaseTracksReleaseTrackBETAGACommandr   r(   r   r   <module>r3      si    0 &  ' D ( 3 5 H D%%**D,=,=,@,@A4<<  Br   