
                         B   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KJr  S	r\S
-   rSrSrSrSrSr\R(                  \R*                  " \R,                  R.                  \R,                  R0                  5       " S S\R2                  5      5       5       rg)zservices mcp enable command.    )services_util)serviceusage)base)common_flags)log)
properties)
console_ioz gcloud beta services operations zwait {0}zservices/%szprojects/{}z
folders/{}zorganizations/{}z/consumerPolicies/{}c                   .    \ rS rSrSr\S 5       rS rSrg)Enable$   a  Enable a service for MCP on a project, folder or organization.

Enable a service for MCP on a project, folder or organization

## EXAMPLES

To enable a service for MCP called `my-service` on the current project, run:

  $ {command} my-service

To enable a service for MCP called `my-service` on the project
`my-project`, run:

  $ {command} my-service --project=my-project

To enable a service for MCP called `my-service` on the folder
`my-folder, run:

  $ {command} my-service --folder=my-folder

To enable a service for MCP called `my-service` on the organization
`my-organization`, run:

  $ {command} my-service --organization=my-organization

To run the same command asynchronously (non-blocking), run:

  $ {command} my-service --async
c                     [         R                  " SS9R                  U 5        [         R                  " U 5        [         R                  " U 5        [
        R                  R                  U 5        g)zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that you can use to add arguments that go on
    the command line after this command. Positional arguments are allowed.
zto enable MCP)suffixN)r   service_flagAddToParseradd_resource_argsskip_mcp_endpoint_check_flagr   
ASYNC_FLAG)parsers    "lib/surface/services/mcp/enable.pyArgsEnable.ArgsE   sK     _5AA&I""6*--f5OO'    c                 4   [         R                  R                  R                  R	                  SS9n[
        R                  U5      nUR                  S5      (       a+  [
        R                  UR                  5      nUR                  nUR                  S5      (       a,  [        R                  UR                  5      nUR                  nOSnUR                  S5      (       a,  [        R                  UR                  5      nUR                  nOSn[        R                  " U SUR                   35      nUR                  (       de  UR                  R                   (       a%  UR                  R                   R"                  (       d%  [$        R&                  " SUR                   S	35        gUR(                  R*                  (       d  [        R,                  " U5      n[.        R0                  " US
SS9nU(       a  [        R2                  " UR                  /UUUS9u  pU	(       at  [4        R6                  " U	R8                  [        R:                  5      n	U	R&                  (       a4  [$        R&                  " SUR                   SU SU	R&                   35        gOg[        R<                  " UR                  UUUS9nUc  gUR>                  (       aB  [@        R                  UR8                  5      n[$        RB                  RE                  SU 35        g[4        R6                  " UR8                  [        R:                  5      nUR&                  (       a  [4        RF                  " U5        g[$        RB                  RE                  SUR                   SU S35        g)zRun 'services mcp enable'.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.

Returns:
  Updated MCP Policy.
T)requiredprojectfolderNorganizationz
/services/zThe service z does not have MCP endpoint.F)defaultthrow_if_unattended)r   r   zFailed to enable the service z for the resource z: z`Asynchronous operation is in progress... Use the following command to wait for its completion:
 zThe MCP endpoint for service z# has been enabled for the resource .)$r   VALUEScorer   Get_PROJECT_RESOURCEformatIsSpecified_FOLDER_RESOURCEr   _ORGANIZATION_RESOURCEr   r   GetServiceV2Betaserviceskip_mcp_endpoint_check	mcpServerurlsr   errorstateenableRulesGetMcpEnabledErrorr	   PromptContinueAddEnableRuler   WaitOperationnameGetOperationV2BetaAddMcpEnableRuleasync__OP_WAIT_CMDstatusPrintPrintOperation)selfargsr   resource_namer   r   service_metadata
enable_msg	do_enableenable_service_op_opcmds                r   Run
Enable.RunS   s    $$,,00$0?G%,,W5M	""'..t||<mg!!&--dkk:m{{ff'',33D4E4EFm&&ll $44/DLL>2 ''$$..''1166	ii&B
C !!--22=Aj++
"i
 
+99\\N%	 
 +99$$l&E&E
 $$II/~ >!?"%6%<%<$=? 		&	&!	
B 
z{{(c	jj%!
 		$	$RWWl.M.M	NB	xx""2&	jj)$,, 8(/,r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rG   __static_attributes__rI   r   r   r   r   $   s!    < ( (ar   r   N)rN   googlecloudsdk.api_lib.servicesr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.servicesr   googlecloudsdk.corer   r   googlecloudsdk.core.consoler	   _OP_BASE_CMDr9   _SERVICEr$   r'   r(   _CONSUMER_POLICY_DEFAULTUniverseCompatibleReleaseTracksReleaseTrackALPHABETASilentCommandr   rI   r   r   <module>r_      s     # 9 8 ( < # * 21j(!  + 1  D%%++T->->-C-CDNT N E Nr   