
    d	                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ  G d	 d
e	j                        Zy)z6Command for getting IAM policies for service accounts.    )absolute_import)division)unicode_literalsN)util)base)iam_utilc                       e Zd ZdZ ej
                  d      dj                  d ej                  d      g      dZ	e
d        Zd Zy	)
GetIamPolicya  Get the IAM policy for a service account.

  This command gets the IAM policy for a service account. If formatted as
  JSON, the output can be edited and used as a policy file for
  set-iam-policy. The output includes an "etag" field identifying the version
  emitted and allowing detection of concurrent policy updates; see
  $ gcloud iam service-accounts set-iam-policy for additional details.

  If the service account does not exist, this command returns a
  `PERMISSION_DENIED` error.
  z
          To print the IAM policy for a given service account, run:

            $ {command} my-iam-account@my-project.iam.gserviceaccount.com
          z

z{description}zget the iam policy of)EXAMPLESDESCRIPTIONc                 p    t        j                  | d       t        j                  j	                  |        y )Nzwhose policy to get)action)r   AddServiceAccountNameArgr   URI_FLAGRemoveFromParser)parsers    2lib/surface/iam/service_accounts/get_iam_policy.pyArgszGetIamPolicy.Args5   s*    %%$& 	MM""6*    c                     t        j                         \  }}|j                  j                  |j	                  t        j                  |j                        t
        j                              S )N)resourceoptions_requestedPolicyVersion)	r   GetClientAndMessagesprojects_serviceAccountsr
   -IamProjectsServiceAccountsGetIamPolicyRequestr   EmailToAccountResourceNameservice_account!MAX_LIBRARY_IAM_SUPPORTED_VERSION)selfargsclientmessagess       r   RunzGetIamPolicy.Run<   s^    002FH**77>>889M9MN66 	? 	89 9r   N)__name__
__module____qualname____doc__textwrapdedentjoinr    GetHintForServiceAccountResourcedetailed_helpstaticmethodr   r#    r   r   r
   r
      se    
 "(// # 
 [[

3(
3
34K
L"N O	- + +9r   r
   )r'   
__future__r   r   r   r(   googlecloudsdk.api_lib.iamr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   ListCommandr
   r.   r   r   <module>r4      s1     = &  '  + ( 3%94## %9r   