
                             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 EkmConfig.    )absolute_import)division)unicode_literals)base)iam)iam_util)resource_argsc                   .    \ rS rSrSr\S 5       rS rSrg)SetIamPolicy   a  Set the IAM policy for an EkmConfig.

Sets the IAM policy for the EkmConfig in a location 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 EkmConfig with location `us-central1`:

  $ {command} policy.json --location=us-central1
c                 T    [         R                  " U SS5        U R                  SSS9  g )NTz
--locationpolicy_filez%JSON or YAML file with the IAM policy)help)r	   AddKmsLocationResourceArgForKMSadd_argument)parsers    ,lib/surface/kms/ekm_config/set_iam_policy.pyArgsSetIamPolicy.Args,   s/    11&$M
 .  0    c                 z   [         R                  " 5       n[        R                  " UR                  UR
                  5      u  p4UR                  R                  R                  5       nSR                  UR                  UR                  5      n[        R                  " XcU5      n[        R                  " US5        U$ )Nz$projects/{0}/locations/{1}/ekmConfig	EkmConfig)cloudkms_baseGetMessagesModuler   ParseYamlOrJsonPolicyFiler   PolicyCONCEPTSlocationParseformat
projectsIdlocationsIdr   SetEkmConfigIamPolicyLogSetIamPolicy)selfargsmessagespolicyupdate_masklocation_refekm_config_nameresults           r   RunSetIamPolicy.Run3   s    ..0H"<<(//+F ==))//1L<CC!9!9;O&&LF_k:Mr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r-   __static_attributes__r/   r   r   r   r      s      0 0r   r   N)r4   
__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>r=      s2    ( &  ' A / ( 3 8"4<< "r   