
    	                         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  G d	 d
ej                        Zy)z)Command to set IAM policy for a resource.    )absolute_import)division)unicode_literals)organizations)base)flags)	org_utilsc                   P    e Zd ZdZddj	                  g d      iZed        Zd Zy)SetIamPolicyzSet IAM policy for an organization.

  Given an organization ID and a file encoded in JSON or YAML that contains the
  IAM policy, this command will set the IAM policy for that organization.
  EXAMPLES
);The following command reads an IAM policy defined in a JSONz>file `policy.json` and sets it for an organization with the IDz`123456789`: z#  $ {command} 123456789 policy.jsonr   r   z>file `policy.json` and sets it for the organization associatedzwith the domain `example.com`:r   z%  $ {command} example.com policy.jsonc                 r    t        j                  d      j                  |        | j                  dd       y )Nz!whose IAM policy you want to set.policy_filez,JSON or YAML file containing the IAM policy.)help)r   IdArgAddToParseradd_argument)parsers    +lib/surface/organizations/set_iam_policy.pyArgszSetIamPolicy.Args4   s4    	KK34@@H
J  L    c                     t        j                  |j                        }|r.t        j                         j                  ||j                        S t        j                  |j                        )N)r	   GetOrganizationIdidr   Clientr   r   UnknownOrganizationError)selfargsorg_ids      r   RunzSetIamPolicy.Run:   sP    ((1F!!#009I9IJJ..tww77r   N)	__name__
__module____qualname____doc__joindetailed_helpstaticmethodr   r"    r   r   r   r      s?     
))  -" L L
8r   r   N)r&   
__future__r   r   r   +googlecloudsdk.api_lib.cloudresourcemanagerr   googlecloudsdk.callioper   (googlecloudsdk.command_lib.organizationsr   r	   Commandr   r*   r   r   <module>r0      s/     0 &  ' E ( : >#84<< #8r   