HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //usr/lib/google-cloud-sdk/lib/surface/services/mcp/__pycache__/enable.cpython-312.pyc
�

�����*�dZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dZed	zZd
Z
dZdZd
ZdZej$ej&ej(ej*j,�Gd�dej.����Zy)zservices mcp enable command.�)�
services_util)�serviceusage)�base)�common_flags)�log)�
propertiesz gcloud beta services operations zwait {0}zservices/%szprojects/{}z
folders/{}zorganizations/{}z/consumerPolicies/{}c�&�eZdZdZed��Zd�Zy)�Enablea	Enables a service for MCP on a project, folder or organization.

  Enables 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��tjd��j|�tj|�tj
j|�y)z�Args 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_argsr�
ASYNC_FLAG)�parsers �"lib/surface/services/mcp/enable.py�ArgszEnable.ArgsFs=�����_�5�A�A�&�I��"�"�6�*��O�O����'�c�d�|jd�r tj|j�}n�|jd�r tj|j
�}nz|jd�r tj|j�}nItjjjjd��}tj|�}|jd�r|jn3tjjjjd��}|jd�r|jnd}|jd�r|j
nd}tj|�d|j���}|jjr |jjj s$t#j$d|j�d	��y|j&j(s}|j+�}d
}|t,j*j.k(rd}n|t,j*j0k(rd}d
|�d|j��}	t#j2d|	�d��ytj4|j|||��}
|j6rBt8j|
j:�}t"j<j?d|���ytAjB|
j:tjD�}
tAjF|
�y)z�Run 'services mcp enable'.

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

    Returns:
      Updated MCP Policy.
    �folder�organization�projectT)�requiredNz
/services/zThe z does not have MCP endpoint.�zalpha zbeta zgcloud zservices enable zwTo enable the MCP endpoint, the service must be enabled first. Please run the following command to enable the service: �.)rrz`Asynchronous operation is in progress... Use the following command to wait for its completion:
 )$�IsSpecified�_FOLDER_RESOURCE�formatr�_ORGANIZATION_RESOURCEr�_PROJECT_RESOURCErr�VALUES�core�Getr�GetServiceV2Beta�service�	mcpServer�urlsr�error�state�enableRules�ReleaseTrackr�ALPHA�BETA�warning�AddMcpEnableRule�async_�_OP_WAIT_CMD�name�status�Printr�
WaitOperation�GetOperationV2Beta�PrintOperation)�self�args�
resource_namerrr�service_metadata�track�track_prefix�enable_command�op�cmds            r�Runz
Enable.RunRs�������!�&�-�-�d�k�k�:�m�	
�	�	�.�	)�,�3�3�D�4E�4E�F�m�	
�	�	�)�	$�'�.�.�t�|�|�<�m��!�!�&�&�.�.�2�2�D�2�A�g�'�.�.�w�7�m����I�&�	
���
�
�
�
#�
#�
+�
+�
/�
/��
/�
>��
!�,�,�X�6�T�[�[�D�F�!�-�-�n�=����4��
$�4�4��/��D�L�L�>�2���
�$�$�.�.��'�'�1�1�6�6�	�i�i�$�t�|�|�n�$@�A�B���!�!�-�-����!�e��l�	�$�#�#�)�)�	)����D�%�%�*�*�*���!���.>�t�|�|�n�M�n�	�k�k��%�&�a�)��

�	�	&�	&������!�	
�B��{�{�������(�c�	�j�j�����%�!��

�	�	$�	$�R�W�W�l�.M�.M�	N�B�� � ��$rN)�__name__�
__module__�__qualname__�__doc__�staticmethodrrA�rrr
r
$s!���<�	(��	(�M%rr
N)rE�googlecloudsdk.api_lib.servicesrr�googlecloudsdk.callioper�#googlecloudsdk.command_lib.servicesr�googlecloudsdk.corerr�_OP_BASE_CMDr1�_SERVICEr rr�_CONSUMER_POLICY_DEFAULT�UniverseCompatible�Hidden�
ReleaseTracksr+r,�
SilentCommandr
rGrr�<module>rSs��� #�9�8�(�<�#�*�1���j�(����!����+��1������������D�%�%�+�+�,�x%�T�
�
�x%�-�
��x%r