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

Sets the IAM policy for the given key 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 key `frodo` with the keyring
`fellowship` and location `global`:

  $ {command} frodo policy.json --keyring=fellowship --location=global
c                 T    [         R                  " U SS5        U R                  SSS9  g )NTkeypolicy_filez%JSON or YAML file with the IAM policy)help)r
   AddKmsKeyResourceArgForKMSadd_argument)parsers    &lib/surface/kms/keys/set_iam_policy.pyArgsSetIamPolicy.Args1   s.    ,,VT5A
 .H J    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	   ParseCryptoKeyNamer   SetCryptoKeyIamPolicyLogSetIamPolicyName)selfargsmessagespolicyupdate_maskcrypto_key_refresults          r   RunSetIamPolicy.Run7   su    ..0H"<<T=M=M=E__NF --d3N&&~{KF^002E:Mr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r)   __static_attributes__r+   r   r   r   r      s"    $ J J
	r   r   N)r0   
__future__r   r   r   googlecloudsdk.api_lib.cloudkmsr   r   r   googlecloudsdk.calliopegooglecloudsdk.command_lib.iamr   googlecloudsdk.command_lib.kmsr	   r
   ReleaseTracksReleaseTrackBETAGACommandr   r+   r   r   <module>r=      sj    $ &  ' A / ( 3 0 8 D%%**D,=,=,@,@A"4<< " B"r   