
                         :   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"                  R&                  5       " S S\R(                  5      5       5       5       rg)z3services MCP 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 MCP policy for a project, folder or organization.

Get effective MCP policy for a project, folder or organization.

## EXAMPLES

 Get effective MCP policy for the current project:

 $ {command}

 Get effective MCP 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 MCP policy. BASIC includes basic metadata about the effective MCP policy. FULL includes every information related to effective MCP policy.BASICFULL)helpchoicesdefaultz
          table(
            EnabledMcpService:label=EnabledMcpService:sort=1,
            EnabledMcpPolicies:label=EnabledMcpPolicies
          )
        )add_argumentr   add_resource_argsdisplay_info	AddFormat)parsers    2lib/surface/services/mcp/policies/get_effective.pyArgsGetEffectivePolicy.Args4   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$                   Ha  n[        R                   R#                  S	5        UR&                   H/  n[        R                   R#                  S
UR(                  -  5        M1     Mc     UR                  S:X  a  [        R                   R#                  S5        / n[*        R,                  " SSS/5      nUR.                   HV  n	U	R0                  R2                   H9  n
UR5                  U" U
R6                  U
R8                  R:                  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/effectiveMcpPolicyformatzMcpEnableRules:z McpServices:z  - %sr   z
Metadata of effective policy:serviceMcpSourcesEnabledMcpServiceEnabledMcpPoliciesN)IsSpecified_FOLDER_RESOURCEr   r   _ORGANIZATION_RESOURCEr   _PROJECT_RESOURCEr   r   VALUEScoreGetr   GetEffectiveMcpPolicyviewr   statusPrintmcpEnableRulesmcpServicesservicecollections
namedtuplemcpEnableRuleMetadatar    additionalPropertiesappendkeyvaluepolicies)selfargsresource_namer   responseenable_rulemcp_serviceresult	resourcesmetadatavaluess              r   RunGetEffectivePolicy.RunI   s    !!&--dkk:m			.	)	),33D4E4EFm			)	$	$'..t||<m!!&&..22D2Ag'..w7m11--tyyH !!o	jj()!00+

)&22K
**

8k&9&99
: 3 1 
f	

:;**"57K!L
	 !66H 22GGfMM)FJJ0E0EFG H 7  
r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rC   __static_attributes__rE   r   r   r	   r	   !   s       (,r   r	   )rJ   r1   googlecloudsdk.api_lib.servicesr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.servicesr   googlecloudsdk.corer   r   r&   r$   r%   UniverseCompatibleHiddenReleaseTracksReleaseTrackALPHABETACommandr	   rE   r   r   <module>rX      s   " :  8 ( < # *!  +  D%%++T->->-C-CDQ Q E  Qr   