
                             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  SSKJr   " S	 S
\R                  5      rg)z!Set the IAM policy for a keyring.    )absolute_import)division)unicode_literals)base)iam)iam_util)flagsc                   .    \ rS rSrSr\S 5       rS rSrg)SetIamPolicy   a  Set the IAM policy for a keyring.

Sets the IAM policy for the given keyring as defined in a JSON or YAML file.

See https://cloud.google.com/iam/docs/managing-policies for details of
the policy file format and contents.

## EXAMPLES
The following command will read am IAM policy defined in a JSON file
'policy.json' and set it for the keyring `fellowship` with location `global`:

  $ {command} fellowship policy.json --location=global
c                     [         R                  " U S5        [         R                  " U S5        U R                  SSS9  g )Nkeyringzwhose IAM policy to updatepolicy_filez%JSON or YAML file with the IAM policy)help)r	   AddLocationFlagAddKeyRingArgumentadd_argument)parsers    *lib/surface/kms/keyrings/set_iam_policy.pyArgsSetIamPolicy.Args+   s<    	&),	V%AB
 .> @    c                 .   [         R                  " 5       n[        R                  " UR                  UR
                  5      u  p4[        R                  " U5      n[        R                  " XSU5      n[        R                  " UR                  5       S5        U$ )Nr   )cloudkms_baseGetMessagesModuler   ParseYamlOrJsonPolicyFiler   Policyr	   ParseKeyRingNamer   SetKeyRingIamPolicyLogSetIamPolicyName)selfargsmessagespolicyupdate_maskkeyring_refresults          r   RunSetIamPolicy.Run2   su    ..0H"<<T=M=M=E__NF ((.K$$[+FF[--/;Mr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r)   __static_attributes__r+   r   r   r   r      s"     @ @	r   r   N)r0   
__future__r   r   r   googlecloudsdk.api_lib.cloudkmsr   r   r   googlecloudsdk.calliopegooglecloudsdk.command_lib.iamr   googlecloudsdk.command_lib.kmsr	   Commandr   r+   r   r   <module>r9      s2    ( &  ' A / ( 3 04<< r   