
    '                        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.                  5       " S S\R0                  5      5       5       r\R(                  \R4                  \R*                  " \R,                  R6                  5       " S S\R0                  5      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)EnableAlpha$     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EnableAlpha.ArgsE   K     _5AA&I""6*--f5OO'    c                 f   [         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  p[4        R6                  " U	R8                  [        R:                  5      n	U	R&                  (       a4  [$        R&                  " SUR                   SU SU	R&                   35        gU(       d  U(       d  [        R<                  " X*5        Og[        R>                  " UR                  UUUS9nUR@                  (       aB  [B        R                  UR8                  5      n[$        RD                  RG                  SU 35        g[4        R6                  " UR8                  [        R:                  5      nUR&                  (       a  [4        RH                  " U5        g[$        RD                  RG                  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 zX does not have MCP endpoint. You can use --skip-mcp-endpoint-check to bypass this check.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(GenerateServiceIdentityForEnabledServiceAddMcpEnableRuleasync__OP_WAIT_CMDstatusPrintPrintOperationselfargsr!   resource_namer"   r#   service_metadata
enable_msg	do_enableenable_service_opservices_to_enableopcmds                r   RunEnableAlpha.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 '= = !!--22=Aj++
"i
 
0<0J0J\\N%	1
- *77""L$C$C
 ""
))-dll^ <#4#:#:";= AA 			&	&!	
B {{(c	jj%!
 		$	$RWWl.M.M	NB	xx""2&	jj)$,, 8(/,r    N	__name__
__module____qualname____firstlineno____doc__staticmethodr   rP   __static_attributes__rR   r   r   r   r   $   s!    < ( (br   r   c                   .    \ rS rSrSr\S 5       rS rSrg)Enable   r   c                     [         R                  " SS9R                  U 5        [         R                  " U 5        [         R                  " U 5        [
        R                  R                  U 5        gr   r   r   s    r   r   Enable.Args   r   r   c                 f   [         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  p[4        R6                  " U	R8                  [        R:                  5      n	U	R&                  (       a4  [$        R&                  " SUR                   SU SU	R&                   35        gU(       d  U(       d  [        R<                  " X*5        Og[        R>                  " UR                  UUUS9nUR@                  (       aB  [B        R                  UR8                  5      n[$        RD                  RG                  SU 35        g[4        R6                  " UR8                  [        R:                  5      nUR&                  (       a  [4        RH                  " U5        g[$        RD                  RG                  SUR                   SU S35        gr   r'   rE   s                r   rP   
Enable.Run   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 '= = !!--22=Aj++
"i
 
0<0J0J\\N%	1
- *77""L$C$C
 ""
))-dll^ <#4#:#:";= AA 			&	&!	
B {{(c	jj%!
 		$	$RWWl.M.M	NB	xx""2&	jj)$,, 8(/,r   rR   NrS   rR   r   r   r\   r\      s!    < ( (ar   r\   N)rX   googlecloudsdk.api_lib.servicesr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.servicesr   googlecloudsdk.corer   r   googlecloudsdk.core.consoler	   _OP_BASE_CMDrA   _SERVICEr+   r.   r/   _CONSUMER_POLICY_DEFAULTUniverseCompatibleReleaseTracksReleaseTrackALPHASilentCommandr   HiddenBETAr\   rR   r   r   <module>rq      s     # 9 8 ( < # * 21j(!  + 1  D%%++,O$$$ O - Of D%%**+NT N ,  Nr   