
                            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	S
.r\R                  " \R                  R                  5       " S S\R                  5      5       r\R                  " \R                  R"                  5       " S S\5      5       r\R                  " \R                  R&                  5       " S S\5      5       rg)z:Command to analyze IAM policy in the specified root asset.    )absolute_import)division)unicode_literals)client_util)base)flagsz8      Analyzes IAM policies that match a request.
      a\        To find out which users have been granted the
      iam.serviceAccounts.actAs permission on a service account, run:

        $ {command} --organization=YOUR_ORG_ID --full-resource-name=YOUR_SERVICE_ACCOUNT_FULL_RESOURCE_NAME --permissions='iam.serviceAccounts.actAs'

      To find out which resources a user can access, run:

        $ {command} --organization=YOUR_ORG_ID --identity='user:u1@foo.com'

      To find out which roles or permissions a user has been granted on a
      project, run:

        $ {command} --organization=YOUR_ORG_ID --full-resource-name=YOUR_PROJECT_FULL_RESOURCE_NAME --identity='user:u1@foo.com'

      To find out which users have been granted the
      iam.serviceAccounts.actAs permission on any applicable resources, run:

        $ {command} --organization=YOUR_ORG_ID --permissions='iam.serviceAccounts.actAs'
      )DESCRIPTIONEXAMPLESc                   J    \ rS rSrSr\r\R                  r	\
S 5       rS rSrg)AnalyzeIamPolicyGA6   z+Analyzes IAM policies that match a request.c                     [         R                  " U5        [         R                  " U5        [         R                  " US5        [         R                  " U5        [         R
                  " U5        g )NT)r   AddAnalyzerParentArgsAddAnalyzerSelectorsGroupAddAnalyzerOptionsGroup AddAnalyzerConditionContextGroup!AddAnalyzerSavedAnalysisQueryArgsclsparsers     'lib/surface/asset/analyze_iam_policy.pyArgsAnalyzeIamPolicyGA.Args>   sJ    	'	##F+	!!&$/	**62	++F3    c                 d    [         R                  " U R                  5      nUR                  U5      $ N)r   AnalyzeIamPolicyClient_API_VERSIONAnalyze)selfargsclients      r   RunAnalyzeIamPolicyGA.RunF   s'    //0A0ABF>>$r    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpr   DEFAULT_API_VERSIONr   classmethodr   r#   __static_attributes__r%   r   r   r   r   6   s,    3-00,4 4 r   r   c                   (    \ rS rSrSr\S 5       rSrg)AnalyzeIamPolicyBETAK   z9BETA version, Analyzes IAM policies that match a request.c                 .    [         R                  U5        g r   )r   r   r   s     r   r   AnalyzeIamPolicyBETA.ArgsO   s    F#r   r%   Nr&   r'   r(   r)   r*   r.   r   r/   r%   r   r   r1   r1   K   s    A$ $r   r1   c                   (    \ rS rSrSr\S 5       rSrg)AnalyzeIamPolicyALPHAT   z:ALPHA version, Analyzes IAM policies that match a request.c                     [         R                  U5        [        R                  " U5      n[        R                  " U5        g r   )r1   r   r   GetOrAddOptionGroup(AddAnalyzerIncludeDenyPolicyAnalysisArgs)r   r   options_groups      r   r   AnalyzeIamPolicyALPHA.ArgsX   s0    f% --f5M	22=Ar   r%   Nr5   r%   r   r   r7   r7   T   s    BB Br   r7   N)r*   
__future__r   r   r   googlecloudsdk.api_lib.assetr   googlecloudsdk.callioper    googlecloudsdk.command_lib.assetr   r+   ReleaseTracksReleaseTrackGACommandr   BETAr1   ALPHAr7   r%   r   r   <module>rH      s    A &  ' 4 ( 2


	6 D%%(()    * ( D%%**+$- $ ,$ D%%++,	B0 	B -	Br   