
    <                        S r SSK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rS	rS
r\R                  \R                  " \R                   R"                  \R                   R$                  5       " S S\R&                  5      5       5       rg)z/services policies get-effective-policy command.    N)serviceusage)base)common_flags)log)
propertieszprojects/{}z
folders/{}zorganizations/{}c                   .    \ rS rSrSr\S 5       rS rSrg)GetEffectivePolicy    a  Get effective policy for a project, folder or organization.

Get effective policy for a project, folder or organization.

## EXAMPLES

 Get effective policy for the current project:

 $ {command}

 Get effective policy for project `my-project`:

 $ {command} --project=my-project
c                     U R                  SSSSS/S9  [        R                  " U 5        U R                  R	                  S5        g )Nz--viewzThe view of the effective policy. BASIC includes basic metadata about the effective policy. FULL includes every information related to effective policy.BASICFULL)helpdefaultchoicesz
          table(
            EnabledService:label=EnabledService:sort=1,
            EnabledPolicies:label=EnabledPolicies
          )
        )add_argumentr   add_resource_argsdisplay_info	AddFormat)parsers    .lib/surface/services/policies/get_effective.pyArgsGetEffectivePolicy.Args2   sS    
, &!  	 ""6*
!! #     c                    UR                  S5      (       a   [        R                  UR                  5      nOUR                  S5      (       a   [        R                  UR
                  5      nO|UR                  S5      (       a   [        R                  UR                  5      nOF[        R                  R                  R                  R                  SS9n[        R                  U5      n[        R                  " US-   UR                  5      nUR                  S5      (       a  U$ [        R                   R#                  S5        UR$                   HW  n[        R                   R#                  S	5        UR&                   H%  n[        R                   R#                  S
U-  5        M'     MY     UR                  S:X  a  [        R                   R#                  S5        / n[(        R*                  " SSS/5      nUR,                   HV  n	U	R.                  R0                   H9  n
UR3                  U" U
R4                  U
R6                  R8                  5      5        M;     MX     U$ g)zRun command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Effective Policy.
folderorganizationprojectT)requiredz/effectivePolicyformatzEnabledRules:z
 Services:z  - %sr   z
Metadata of effective policy:serviceSourcesEnabledServiceEnabledPoliciesN)IsSpecified_FOLDER_RESOURCEr   r   _ORGANIZATION_RESOURCEr   _PROJECT_RESOURCEr   r   VALUEScoreGetr   GetEffectivePolicyV2Betaviewr   statusPrintenableRulesservicescollections
namedtupleenableRuleMetadatar    additionalPropertiesappendkeyvaluepolicies)selfargsresource_namer   responseenable_ruleserviceresult	resourcesmetadatavaluess              r   RunGetEffectivePolicy.RunG   s    !!&--dkk:m			.	)	),33D4E4EFm			)	$	$'..t||<m!!&&..22D2Ag'..w7m44**DIIH !!o	jj'!--+

&"++G
**

8g-
. , .
 
f	

:;**/1BC
	 !33H //DDfMM)FJJ0E0EFG E 4  
r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rB   __static_attributes__rD   r   r   r	   r	       s       (,r   r	   )rI   r0   googlecloudsdk.api_lib.servicesr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.servicesr   googlecloudsdk.corer   r   r&   r$   r%   UniverseCompatibleReleaseTracksReleaseTrackALPHABETACommandr	   rD   r   r   <module>rV      s   " 6  8 ( < # *!  +  D%%++T->->-C-CDQ Q E Qr   