
    =                     z    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	\R                  5      rg
)z6Command for setting IAM policies for service accounts.    )absolute_import)division)unicode_literals)util)base)iam_utilc                       \ rS rSrSr\R                  " SS5      r\S==   S\R                  " S5      -   -  ss'   \	S 5       r
S	 rS
rg)SetIamPolicy   a  Set the IAM policy for a service account.

This command replaces the existing IAM policy for a service account, given
an IAM_ACCOUNT and a file encoded in JSON or YAML that contains the IAM
policy. If the given policy file specifies an "etag" value, then the
replacement will succeed only if the policy already in place matches that
etag. (An etag obtained via $ gcloud iam service-accounts get-iam-policy will
prevent the replacement if the policy for the service account has been
subsequently updated.) A policy file that does not contain an etag value will
replace any existing policy for the service account.

If the service account does not exist, this command returns a
`PERMISSION_DENIED` error.
service accountz1my-iam-account@my-project.iam.gserviceaccount.comDESCRIPTIONz

zset the iam policy ofc                 P    [         R                  " U SS9  U R                  SSSS9  g )Nzwhose policy to set)actionpolicy_filePOLICY_FILEzFPath to a local JSON or YAML formatted file containing a valid policy.)metavarhelp)r   AddServiceAccountNameArgadd_argument)parsers    2lib/surface/iam/service_accounts/set_iam_policy.pyArgsSetIamPolicy.Args1   s6    %%$& %  &    c           	         [         R                  " 5       u  p#[        R                  " UR                  UR
                  5      n[        R                  Ul        UR                  R                  UR                  [        R                  " UR                  5      UR                  US9S95      n[        R                  " UR                  S5        U$ )N)policy)resourcesetIamPolicyRequestr   )r   GetClientAndMessagesr   ParsePolicyFiler   Policy!MAX_LIBRARY_IAM_SUPPORTED_VERSIONversionprojects_serviceAccountsr
   -IamProjectsServiceAccountsSetIamPolicyRequestEmailToAccountResourceNameservice_accountSetIamPolicyRequestLogSetIamPolicy)selfargsclientmessagesr   results         r   RunSetIamPolicy.Run<   s    002F%%d&6&6HF??FN,,99>>889M9MN ( < < != ! 	? 	 !F
 T113DEMr    N)__name__
__module____qualname____firstlineno____doc__r   GetDetailedHelpForSetIamPolicydetailed_help GetHintForServiceAccountResourcestaticmethodr   r/   __static_attributes__r1   r   r   r
   r
      sa     99LN-&//
!##$ $ & &r   r
   N)r6   
__future__r   r   r   googlecloudsdk.api_lib.iamr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   Commandr
   r1   r   r   <module>rA      s,     = &  ' + ( 3,4<< ,r   